Skip to content

Commit

Permalink
refactor: error handler callback to return false
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan committed Oct 21, 2022
1 parent 1571861 commit f3205ea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions system/Debug/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,19 @@ public function exceptionHandler(Throwable $exception)
*
* This seems to be primarily when a user triggers it with trigger_error().
*
* @return bool
*
* @throws ErrorException
*
* @codeCoverageIgnore
*/
public function errorHandler(int $severity, string $message, ?string $file = null, ?int $line = null)
{
if (! (error_reporting() & $severity)) {
return;
if (error_reporting() & $severity) {
throw new ErrorException($message, 0, $severity, $file, $line);
}

throw new ErrorException($message, 0, $severity, $file, $line);
return false; // return false to propagate the error to PHP standard error handler
}

/**
Expand Down

0 comments on commit f3205ea

Please sign in to comment.