Skip to content

Commit d87e9e3

Browse files
Handling ConnectException (#299)
* Handling ConnectException * Syntax changes Co-authored-by: Louis Lagrange <[email protected]>
1 parent b9973cd commit d87e9e3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/WebPush.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ public function flush(?int $batchSize = null): \Generator
182182
})
183183
->otherwise(function ($reason) {
184184
/** @var RequestException $reason **/
185-
return new MessageSentReport($reason->getRequest(), $reason->getResponse(), false, $reason->getMessage());
185+
if (method_exists($reason, 'getResponse')) {
186+
$response = $reason->getResponse();
187+
} else {
188+
$response = null;
189+
}
190+
return new MessageSentReport($reason->getRequest(), $response, false, $reason->getMessage());
186191
});
187192
}
188193

0 commit comments

Comments
 (0)