Handle HTTP request exceptions

master
Nikola Forró 6 years ago
parent 7da2a6a449
commit e2fcc30c99

@ -98,7 +98,12 @@ class LLInstagramPlugin extends Plugin
$baseurl = Uri::getCurrentUri()->withScheme('https')->getBaseUrl();
$url = sprintf('%s%s?%s', $baseurl, $this::API_URL, http_build_query($params));
$data = Response::get($url);
try {
$data = Response::get($url);
} catch(\Exception $e) {
$data = '[]';
}
return json_decode($data);
}

Loading…
Cancel
Save