public static function onError($code, $message, $file, $line, $context) { // Error has been suppressed with @ sign if (error_reporting() === 0) { return; } if ($code & E_WARNING || $code & E_USER_WARNING) { $e = new PhpWarningException(); } elseif ($code & E_NOTICE || $code & E_USER_NOTICE || $code & E_DEPRECATED || $code & E_USER_DEPRECATED || $code & E_STRICT) { $e = new PhpNoticeException(); } else { $e = new PhpErrorException(); } $e->setCode($code); $e->setMessage($message); $e->setFile($file); $e->setLine($line); $e->setContext($context); throw $e; }
/** * PHP Error handler * * @param int $severity the severity code * @param string $message the error message * @param string $filepath the path to the file throwing the error * @param int $line the line number of the error * @return bool whether to continue with execution */ public static function error_handler($severity, $message, $filepath, $line) { // don't do anything if error reporting is disabled if (error_reporting() !== 0) { $fatal = (bool) (!in_array($severity, \Config::get('errors.continue_on', array()))); if ($fatal) { throw new \PhpErrorException($message, $severity, 0, $filepath, $line); } else { $e = new \PhpErrorException($message, $severity, 0, $filepath, $line); $e->handle(); } } return true; }