Skip to content

Commit

Permalink
Handling ConnectException (#299)
Browse files Browse the repository at this point in the history
* Handling ConnectException

* Syntax changes

Co-authored-by: Louis Lagrange <[email protected]>
  • Loading branch information
rupamjbordoloi and Minishlink authored Apr 8, 2021
1 parent b9973cd commit d87e9e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/WebPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ public function flush(?int $batchSize = null): \Generator
})
->otherwise(function ($reason) {
/** @var RequestException $reason **/
return new MessageSentReport($reason->getRequest(), $reason->getResponse(), false, $reason->getMessage());
if (method_exists($reason, 'getResponse')) {
$response = $reason->getResponse();
} else {
$response = null;
}
return new MessageSentReport($reason->getRequest(), $response, false, $reason->getMessage());
});
}

Expand Down

0 comments on commit d87e9e3

Please sign in to comment.