From e2fcc30c9920eebb84754150317daebb01e1ddd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Sat, 5 Jan 2019 12:42:33 +0100 Subject: [PATCH] Handle HTTP request exceptions --- llinstagram.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/llinstagram.php b/llinstagram.php index 6402e7b..38c1570 100644 --- a/llinstagram.php +++ b/llinstagram.php @@ -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); }