Skip to content
Browse files

(Change) include http response code in exceptions

  • Loading branch information...
1 parent c9f3f0f commit 0b018721f1507f061a6003c1ca8296be02cef23a @akalsey akalsey committed Jan 17, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 tropo-rest.class.php
View
4 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;
}

0 comments on commit 0b01872

Please sign in to comment.
Something went wrong with that request. Please try again.