Closed sdrib closed 1 year ago
@sdrib,
Sorry for the extended delay on reviewing your change here.
We've got a quick improvement to your change before we can merge, to account for situations (such as a curl exception) where the exception doesn't actually have a response. Something like this should account for that:
- private function handleException(\Exception $e)
+ private function handleException(\Exception $e)
{
- $response = $e->getResponse();
-
- return array(
- "error_description" => $e->getMessage() ,
- "error_code" => $response->getStatusCode(),
- "error_contents" => (string) $response->getBody()->getContents()
+ $error = array(
+ "error_description" => $e->getMessage()
+ );
+
+ if ($e->hasResponse()) {
+ $response = $e->getResponse();
+ $error = array_merge($error, array(
+ "error_code" => $response->getStatusCode(),
+ "error_contents" => (string) $response->getBody()->getContents()
+ ));
+ }
+
+ return $error;
}
Did you want to update your master and we'll (finally) get this merged in?
Done that just now @adamjudd 👍
The responses we currently get are not parseable and truncated.
Before:
After: