You are here

function _js_error_handler in JS Callback Handler 7.2

Provides custom PHP error handling.

Parameters

int $error_level: The level of the error raised.

string $message: The error message.

1 string reference to '_js_error_handler'
js_execute_request in ./js.module
Loads the requested module and executes the requested callback.

File

./js.module, line 483
JavaScript callback handler module.

Code

function _js_error_handler($error_level, $message) {
  if ($error_level & error_reporting()) {
    require_once DRUPAL_ROOT . '/includes/errors.inc';
    $types = drupal_error_levels();
    list($severity_msg, $severity_level) = $types[$error_level];
    $backtrace = debug_backtrace();
    $caller = _drupal_get_last_caller($backtrace);
    _js_log_php_error(array(
      '%type' => isset($types[$error_level]) ? $severity_msg : 'Unknown error',
      // The standard PHP error handler considers that the error messages
      // are HTML. Mimic this behavior here.
      '!message' => filter_xss_admin($message),
      '%function' => $caller['function'],
      '%file' => $caller['file'],
      '%line' => $caller['line'],
      'severity_level' => $severity_level,
    ), $error_level == E_RECOVERABLE_ERROR);
  }
}