/** * Gets an array from an HttpAdapterException. * * @param HttpAdapterException $exception * * @return array */ public function exceptionToArray(HttpAdapterException $exception) { $array = ['code' => $exception->getCode(), 'message' => $exception->getMessage()]; if ($exception->hasRequest()) { $array['request'] = $this->internalRequestToArray($exception->getRequest()); } if ($exception->hasResponse()) { $array['response'] = $this->responseToArray($exception->getResponse()); } return $array; }