Ignore errors triggered outside of Raven.context()

Could someone please advice is there’s a way to completely ignore errors which happen outside of the scope of

Raven.context(function() {
// my JS code here

To make things more clear, before executing it I’m configuring Raven with my own custom value for logger. This means that any error which happened within the above construction will be tagged with that value.

But also I’m not interested in reporting any error which happened outside of that block. So I was thinking maybe it’s possible to ignore all error which don’t have my custom value set in logger?

I know there’s ignoreErrors property in configuration, but it seems to be only valid for error message, not for the logger.

Thanks so much!

How specifically are you marking your errors?

Ok, I think I made it a little bit confusing.

Here’s how I use it:


Raven.context(function() {
throw new Error(‘broken’); // this will be reported to Sentry. That’s good

// The following line will trigger an error - Uncaught TypeError: Cannot read property ‘someproperty’ of undefined
// It will be reported too, but I want it to be ignored by Sentry instead.
// Basically what I want is to make Raven ignore any other error which occurs outside of the Raven.context() block

You may skip installing Raven Raven.install(), which won’t attach global handler. However, it will also skip breadcrumbs and built-ins instrumentation (timeouts, intervals, XHRs etc.), so there’s a trade-off and there’s no way around it at the time.