使用已弃用的客户端 Raven,您可以忽略麻烦的错误:
Raven.config('your-dsn', {
ignoreErrors: [
'Can\'t execute code from freed script',
/SecurityError\: DOM Exception 18$/
]
}).install();
我发现新客户端的唯一方法是使用 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;
}
});
我搜索了所有文档,但没有找到忽略错误的全局方法。
最佳答案
似乎有一个ignoreErrors
配置选项。它记录在他们的示例应用程序中:
关于javascript - 如何使用 sentry v5 全局忽略错误以减少噪音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55846690/