Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/Illuminate/Http/Client/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Batch
/**
* The callback to run after a request from the batch fails.
*
* @var (\Closure($this, int|string, \Illuminate\Http\Response|\Illuminate\Http\Client\RequestException): void)|null
* @var (\Closure($this, int|string, \Illuminate\Http\Response|\Illuminate\Http\Client\RequestException|\Illuminate\Http\Client\ConnectionException): void)|null
*/
protected $catchCallback = null;

Expand Down Expand Up @@ -171,7 +171,7 @@ public function progress(Closure $callback): self
/**
* Register a callback to run after a request from the batch fails.
*
* @param (\Closure($this, int|string, \Illuminate\Http\Response|\Illuminate\Http\Client\RequestException): void) $callback
* @param (\Closure($this, int|string, \Illuminate\Http\Response|\Illuminate\Http\Client\RequestException|\Illuminate\Http\Client\ConnectionException): void) $callback
* @return Batch
*/
public function catch(Closure $callback): self
Expand Down Expand Up @@ -247,8 +247,11 @@ public function send(): array
return $result;
}

if (($result instanceof Response && $result->failed()) ||
$result instanceof RequestException) {
if (
($result instanceof Response && $result->failed()) ||
$result instanceof RequestException ||
$result instanceof ConnectionException
) {
$this->incrementFailedRequests();

if ($this->catchCallback !== null) {
Expand All @@ -261,7 +264,7 @@ public function send(): array
'rejected' => function ($reason, $key) {
$this->decrementPendingRequests();

if ($reason instanceof RequestException) {
if ($reason instanceof RequestException || $reason instanceof ConnectionException) {
$this->incrementFailedRequests();

if ($this->catchCallback !== null) {
Expand Down