How to Prevent Sending JavaScript Errors from Specific Browsers with Sentry raven-js
I’ll introduce sample code for preventing client-side JavaScript errors from specific browsers from being sent with Sentry raven-js.
This article discusses raven-js.
Nowadays, @sentry/browser is used instead, so use this for new implementations.
Since IE versions before Internet Explorer 11 (IE11) are naturally out of support, the background is that I don’t want client-side JavaScript errors occurring in those browsers to be sent to Sentry.
Raven.config('https://[email protected]/12345', {
shouldSendCallback(data) {
var ua = window.navigator.userAgent.toLowerCase();
// Don't send errors from IE versions before IE11
if (ua.indexOf('msie') !== -1) {
return false;
}
return true;
}
}).install();
That’s all from the Gemba.