public function getException()
 {
     if (!$this->hasException()) {
         return;
     }
     if ($this->exception->hasResponse() && $this->exception->getResponse()->getBody()->getSize() !== null) {
         $this->exception->getResponse()->getBody()->seek(0, SEEK_SET);
     }
     return $this->exception;
 }
 /**
  * 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;
 }