From 0b018721f1507f061a6003c1ca8296be02cef23a Mon Sep 17 00:00:00 2001 From: Adam Kalsey Date: Tue, 17 Jan 2012 21:09:42 -0800 Subject: [PATCH] (Change) include http response code in exceptions --- tropo-rest.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tropo-rest.class.php b/tropo-rest.class.php index e39fb4f..d087ba8 100644 --- a/tropo-rest.class.php +++ b/tropo-rest.class.php @@ -299,8 +299,8 @@ protected function makeAPICall($method, $url, $payload=NULL) { throw new Exception('An error occurred: '.$this->error); } else { if (substr($this->curl_http_code, 0, 1) != '2') { - $e = 'An error occurred: Invalid HTTP response returned: '.$this->curl_http_code . ' - Details: ' . $this->result; - throw new Exception($e); + $body = json_decode($this->result); + throw new Exception($body->error, $this->curl_http_code); } return $this->result; }