|
12 | 12 |
|
13 | 13 | use GuzzleHttp\Client;
|
14 | 14 | use GuzzleHttp\ClientInterface;
|
15 |
| -use GuzzleHttp\Exception as Guzzle; |
| 15 | +use GuzzleHttp\Exception as GuzzleExceptions; |
16 | 16 | use Http\Client\Exception\HttpException;
|
17 | 17 | use Http\Client\Exception\NetworkException;
|
18 | 18 | use Http\Client\Exception\RequestException;
|
@@ -45,27 +45,27 @@ public function sendRequest(RequestInterface $request)
|
45 | 45 | {
|
46 | 46 | try {
|
47 | 47 | return $this->client->send($request);
|
48 |
| - } catch (Guzzle\SeekException $e) { |
| 48 | + } catch (GuzzleExceptions\SeekException $e) { |
49 | 49 | throw new RequestException($e->getMessage(), $request, $e);
|
50 |
| - } catch (Guzzle\TransferException $e) { |
51 |
| - throw $this->handleTransferException($e); |
| 50 | + } catch (GuzzleExceptions\GuzzleException $e) { |
| 51 | + throw $this->handleException($e); |
52 | 52 | }
|
53 | 53 | }
|
54 | 54 |
|
55 | 55 | /**
|
56 | 56 | * Converts a Guzzle exception into an Httplug exception.
|
57 | 57 | *
|
58 |
| - * @param Guzzle\TransferException $exception |
| 58 | + * @param GuzzleExceptions\TransferException $exception |
59 | 59 | *
|
60 | 60 | * @return RequestException
|
61 | 61 | */
|
62 |
| - private function handleTransferException(Guzzle\TransferException $exception) |
| 62 | + private function handleException(GuzzleExceptions\GuzzleException $exception) |
63 | 63 | {
|
64 |
| - if ($exception instanceof Guzzle\ConnectException || $exception instanceof Guzzle\TooManyRedirectsException) { |
| 64 | + if ($exception instanceof GuzzleExceptions\ConnectException) { |
65 | 65 | return new NetworkException($exception->getMessage(), $exception->getRequest(), $exception);
|
66 | 66 | }
|
67 | 67 |
|
68 |
| - if ($exception instanceof Guzzle\RequestException) { |
| 68 | + if ($exception instanceof GuzzleExceptions\RequestException) { |
69 | 69 | // Make sure we have a response for the HttpException
|
70 | 70 | if ($exception->hasResponse()) {
|
71 | 71 | return new HttpException(
|
|
0 commit comments