Skip to content
Snippets Groups Projects
Commit d2e41e68 authored by Aaron Bauman's avatar Aaron Bauman
Browse files

by aaronbauman - prevent exception within catch()

parent 7cd5afbf
No related branches found
No related tags found
No related merge requests found
...@@ -84,7 +84,7 @@ class RestClient { ...@@ -84,7 +84,7 @@ class RestClient {
} }
catch (RequestException $e) { catch (RequestException $e) {
// RequestException gets thrown for any response status but 2XX // RequestException gets thrown for any response status but 2XX
$this->response = new RestResponse($e->getResponse()); $this->response = $e->getResponse();
} }
if (!is_object($this->response)) { if (!is_object($this->response)) {
throw new Exception('Unknown error occurred during API call'); throw new Exception('Unknown error occurred during API call');
...@@ -97,10 +97,10 @@ class RestClient { ...@@ -97,10 +97,10 @@ class RestClient {
// throws anything but a RequestException, let it bubble up. // throws anything but a RequestException, let it bubble up.
$this->refreshToken(); $this->refreshToken();
try { try {
$this->response = $this->apiHttpRequest($path, $params, $method); $this->response = new RestResponse($this->apiHttpRequest($path, $params, $method));
} }
catch (RequestException $e) { catch (RequestException $e) {
$this->response = new RestResponse($e->getResponse()); $this->response = $e->getResponse();
throw $e; throw $e;
} }
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment