Skip to content

Commit 9aa452e

Browse files
authored
Change type of exception handled in rejected promise (#208)
As noted in Guzzle's [upgrade document](https://github.com/guzzle/guzzle/blob/master/UPGRADING.md), in Guzzle 7 `GuzzleHttp\Exception\ConnectException` now extends from `GuzzleHttp\Exception\TransferException` instead of `GuzzleHttp\Exception\RequestException`, which now causes a fatal error in the rejected callback because ConnectException is no longer an instance of RequestException. This change allows for ConnectException to be handled when using Guzzle 7 while remaining B/C with Guzzle 6.
1 parent f34ba95 commit 9aa452e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MonitorCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Generator;
66
use GrahamCampbell\GuzzleFactory\GuzzleFactory;
7-
use GuzzleHttp\Exception\RequestException;
7+
use GuzzleHttp\Exception\TransferException;
88
use GuzzleHttp\Promise\EachPromise;
99
use Illuminate\Support\Collection;
1010
use Psr\Http\Message\ResponseInterface;
@@ -27,7 +27,7 @@ public function checkUptime(): void
2727
$monitor->uptimeRequestSucceeded($response);
2828
},
2929

30-
'rejected' => function (RequestException $exception, $index) {
30+
'rejected' => function (TransferException $exception, $index) {
3131
$monitor = $this->getMonitorAtIndex($index);
3232

3333
ConsoleOutput::error("Could not reach {$monitor->url} error: `{$exception->getMessage()}`");

0 commit comments

Comments
 (0)