function Promise::handleException
Converts a Guzzle exception into an Httplug exception.
Return value
1 call to Promise::handleException()
- Promise::__construct in vendor/
php-http/ guzzle7-adapter/ src/ Promise.php
File
-
vendor/
php-http/ guzzle7-adapter/ src/ Promise.php, line 101
Class
- Promise
- Wrapper around Guzzle promises.
Namespace
Http\Adapter\Guzzle7Code
private function handleException(GuzzleExceptions\GuzzleException $exception) {
if ($exception instanceof GuzzleExceptions\ConnectException) {
return new HttplugException\NetworkException($exception->getMessage(), $exception->getRequest(), $exception);
}
if ($exception instanceof GuzzleExceptions\RequestException) {
// Make sure we have a response for the HttpException
if ($exception->hasResponse()) {
return new HttplugException\HttpException($exception->getMessage(), $exception->getRequest(), $exception->getResponse(), $exception);
}
return new HttplugException\RequestException($exception->getMessage(), $exception->getRequest(), $exception);
}
return new HttplugException\TransferException($exception->getMessage(), 0, $exception);
}