Skip to content
Advertisement

How to globally ignore errors with sentry v5 to reduce noise

With the deprecated client Raven you could ignore troublesome errors :

Raven.config('your-dsn', {
    ignoreErrors: [
        'Can't execute code from freed script',
        /SecurityError: DOM Exception 18$/
    ]
}).install();

The only way I found with the new client is with the before-send hook : https://docs.sentry.io/error-reporting/configuration/filtering/?platform=browser#before-send

import * as Sentry from '@sentry/browser';

init({
  beforeSend(event, hint) {
    const { message } = hint.originalException;
    if (message && message.match(/database unavailable/i)) {
      return null;
    }
    return event;
  }
});

I searched all over the docs but didn’t find a global way to ignore errors.

Advertisement

Answer

There seems to be an ignoreErrors config option. It’s documented in their example app here:

https://github.com/getsentry/sentry-javascript/blob/ab7ba810a97a2acae3dbd2c82b07e3972147bb97/packages/browser/examples/app.js#L38

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement