/**
  * Converts a Guzzle exception into an Httplug exception.
  *
  * @param GuzzleExceptions\TransferException $exception
  * @param RequestInterface                   $request
  *
  * @return HttplugException
  */
 private function handleException(GuzzleExceptions\TransferException $exception, RequestInterface $request)
 {
     if ($exception instanceof GuzzleExceptions\ConnectException) {
         return new HttplugException\NetworkException($exception->getMessage(), $request, $exception);
     }
     if ($exception instanceof GuzzleExceptions\RequestException) {
         // Make sure we have a response for the HttpException
         if ($exception->hasResponse()) {
             $psr7Response = $this->createResponse($exception->getResponse());
             return new HttplugException\HttpException($exception->getMessage(), $request, $psr7Response, $exception);
         }
         return new HttplugException\RequestException($exception->getMessage(), $request, $exception);
     }
     return new HttplugException\TransferException($exception->getMessage(), 0, $exception);
 }