Skip to content

Commit

Permalink
(Change) include http response code in exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
akalsey committed Jan 18, 2012
1 parent c9f3f0f commit 0b01872
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tropo-rest.class.php
Expand Up @@ -299,8 +299,8 @@ protected function makeAPICall($method, $url, $payload=NULL) {
throw new Exception('An error occurred: '.$this->error); throw new Exception('An error occurred: '.$this->error);
} else { } else {
if (substr($this->curl_http_code, 0, 1) != '2') { if (substr($this->curl_http_code, 0, 1) != '2') {
$e = 'An error occurred: Invalid HTTP response returned: '.$this->curl_http_code . ' - Details: ' . $this->result; $body = json_decode($this->result);
throw new Exception($e); throw new Exception($body->error, $this->curl_http_code);
} }
return $this->result; return $this->result;
} }
Expand Down

0 comments on commit 0b01872

Please sign in to comment.