craigmichaelmartin
craigmichaelmartin

Reputation: 6489

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

Upvotes: 4

Views: 3091

Answers (1)

Kamil Ogórek
Kamil Ogórek

Reputation: 376

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;
  }
})

Upvotes: 3

Related Questions