You are here

function _raven_error_handler in Raven: Sentry Integration 7

PHP error handler.

Parameters

int $code: The level of the error raised.

string $message: The error message.

string $file: The filename that the error was raised in.

int $line: The line number the error was raised at.

array $context: An array of every variable that existed in the scope the error was triggered in.

1 string reference to '_raven_error_handler'
raven_init in ./raven.module
Implements hook_init().

File

./raven.module, line 204
Allows to track errors to Sentry server.

Code

function _raven_error_handler($code, $message, $file = '', $line = 0, array $context = array()) {
  $error_levels = _raven_get_enabled_error_levels();
  if ($error_levels & $code & error_reporting()) {
    $filter = array(
      'process' => TRUE,
      'code' => $code,
      'message' => $message,
      'file' => $file,
      'line' => $line,
      'context' => $context,
    );
    drupal_alter('raven_error_filter', $filter);
    if ($filter['process']) {
      $raven_error_handler = _raven_get_error_handler();
      $e = new ErrorException($message, 0, $code, $file, $line);
      $raven_error_handler
        ->handleException($e, TRUE, $context);
    }
  }
  $old_error_handler = $GLOBALS['_raven_old_error_handler'];
  if ($old_error_handler) {
    call_user_func($old_error_handler, $code, $message, $file, $line, $context);
  }
}