From b30a834d5634f53b4438a1f5645a41bf085cfd43 Mon Sep 17 00:00:00 2001 From: Simon Boulet Date: Thu, 7 Mar 2013 10:01:14 -0500 Subject: [PATCH] Throw exception on curl exec error --- Loggly.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Loggly.php b/Loggly.php index 7591fd7..e1d059d 100644 --- a/Loggly.php +++ b/Loggly.php @@ -76,10 +76,13 @@ public function makeRequest($path, $params = null, $method = 'GET') { } $result = curl_exec($curl); - $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); + + if (!$result) { + throw new LogglyException(curl_error($curl)); + } $json = json_decode($result, true); - if (!$json && $result) { + if (!$json) { # API is inconsistent $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); if ($status >= 200 && $status <= 299) {