Skip to content

Commit

Permalink
handle exceptions in batch callbacks (#38327)
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid authored Aug 10, 2021
1 parent 7b88554 commit 2f44389
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Illuminate/Bus/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,15 @@ public function delete()
*/
protected function invokeHandlerCallback($handler, Batch $batch, Throwable $e = null)
{
return $handler instanceof SerializableClosure
? $handler->__invoke($batch, $e)
: call_user_func($handler, $batch, $e);
try {
return $handler instanceof SerializableClosure
? $handler->__invoke($batch, $e)
: call_user_func($handler, $batch, $e);
} catch (Throwable $e) {
if (function_exists('report')) {
report($e);
}
}
}

/**
Expand Down

0 comments on commit 2f44389

Please sign in to comment.