You are here

function hook_raven_error_filter_alter in Raven: Sentry Integration 7

Filter known errors so do not log them to Sentry again and again.

Parameters

array $error: A reference to array containing error info.

1 function implements hook_raven_error_filter_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

raven_raven_error_filter_alter in ./raven.module
Implements hook_raven_error_filter_alter().
1 invocation of hook_raven_error_filter_alter()
_raven_error_handler in ./raven.module
PHP error handler.

File

./raven.api.php, line 49
Sample hooks demonstrating usage of Raven.

Code

function hook_raven_error_filter_alter(array &$error) {
  $known_errors = array();
  drupal_alter('raven_known_php_errors', $known_errors);

  // Filter known errors to prevent spamming the Sentry server.
  foreach ($known_errors as $known_error) {
    $check = TRUE;
    foreach ($known_error as $key => $value) {
      if ($error[$key] != $value) {
        $check = FALSE;
        break;
      }
    }
    if ($check) {
      $error['process'] = FALSE;
      break;
    }
  }
}