Skip to content

Commit

Permalink
Merge pull request #28617 from robinvdvleuten/rescue-without-report
Browse files Browse the repository at this point in the history
[5.8] Allow rescued exception reporting to be disabled
  • Loading branch information
taylorotwell authored May 26, 2019
2 parents 670df8c + 84de1ea commit 4cff1ee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -703,14 +703,17 @@ function request($key = null, $default = null)
*
* @param callable $callback
* @param mixed $rescue
* @param bool $report
* @return mixed
*/
function rescue(callable $callback, $rescue = null)
function rescue(callable $callback, $rescue = null, $report = true)
{
try {
return $callback();
} catch (Throwable $e) {
report($e);
if ($report) {
report($e);
}

return value($rescue);
}
Expand Down

0 comments on commit 4cff1ee

Please sign in to comment.