-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Custom exceptions throw globally aren't filtered by whitelistUrls #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
+1 |
@bradvogel – Your custom error needs to inherit from the Error prototype, e.g. function CustomError = function(message) {
this.message = message;
};
CustomError.prototype = Error.prototype; Otherwise Raven does not consider this an error – it only knows that it is a function object, and cannot make any assertions about its properties. For example, your custom error will not have a |
Oh, I think I've misread. Your example was meant to (intentionally) demonstrate a non-error that passes through to |
In which case, I'm not sure what we can do. We extract the URL from an Error object's properties. A message / freeform object has no such property, so Raven.js does not know from which file the message originated from. |
Hi Ben :). The throw object is actually out of our control. It's throw by third party code running on the page. So if My thought is that the |
Right. In your example though, |
Ok I see. But the bug makes sense - right? I just need a way to suppress all errors from third party scripts from making it into Sentry. |
:) |
Hey @benvinegar, cool to see this fixed. Will |
It already does? For normal exceptions ( |
When some third party code throws a non-Error object, it's being collected by Raven's
window.onerror
handler and being fowarded tocaptureMessage
, which doesn't usewhitelistUrls
to filter exceptions.I'd expect that ALL global exceptions (that get caught by
window.onerror
) are passed throughwhitelistUrls
, regardless of their type.Code to reproduce:
This is an issue if you're including third party libraries on the page that might throw their own custom error object, and not catch it.
The text was updated successfully, but these errors were encountered: