如何防止Sentry在浏览器中报javascript错误?
How can I prevent Sentry from reporting an error in javascript in the browswer?
似乎 Sentry 正在报告我故意吞下的错误。为什么是这样?我怎样才能告诉哨兵不要报告这个被吞噬的错误?
Sentry.init({
ignoreErrors: ['NotSupportedError']
// or
ignoreErrors: [/operation is not supported/]
})
或与beforeSend
Sentry.init({
beforeSend(event) {
// or `value` instead of a `type`
if (event.exception && event.exception.values[0].type === 'NotSupportedError') {
return null
}
return event;
}
})
似乎 Sentry 正在报告我故意吞下的错误。为什么是这样?我怎样才能告诉哨兵不要报告这个被吞噬的错误?
Sentry.init({
ignoreErrors: ['NotSupportedError']
// or
ignoreErrors: [/operation is not supported/]
})
或与beforeSend
Sentry.init({
beforeSend(event) {
// or `value` instead of a `type`
if (event.exception && event.exception.values[0].type === 'NotSupportedError') {
return null
}
return event;
}
})