Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent Sentry from reporting an error in javascript in the browswer?

It seems like Sentry is reporting an error I intentionally swallow. Why is this? How can I tell Sentry not to report on this swallowed error?

Sentry Screenshot

like image 312
craigmichaelmartin Avatar asked Oct 23 '25 09:10

craigmichaelmartin


1 Answers

Sentry.init({
  ignoreErrors: ['NotSupportedError']
  // or
  ignoreErrors: [/operation is not supported/]
})

or with beforeSend

Sentry.init({
  beforeSend(event) {
    // or `value` instead of a `type`
    if (event.exception && event.exception.values[0].type === 'NotSupportedError') {
      return null
    }
    return event;
  }
})
like image 170
Kamil Ogórek Avatar answered Oct 26 '25 03:10

Kamil Ogórek