Skip to content

Custom exceptions throw globally aren't filtered by whitelistUrls #503

Closed
@bradvogel

Description

@bradvogel

When some third party code throws a non-Error object, it's being collected by Raven's window.onerror handler and being fowarded to captureMessage, which doesn't use whitelistUrls to filter exceptions.

I'd expect that ALL global exceptions (that get caught by window.onerror) are passed through whitelistUrls, regardless of their type.

Code to reproduce:

  // Set up Raven:
  Raven.config('...', {
    whitelistUrls: [/myfile\.js/],
  });

  // Install window.onerror handler.
  Raven.install();

  setTimeout(function(){
     throw new Error('this will get filtered out by whitelistUrls since this isn\'t being thrown from that file');
  });

  CustomError = function(message) {
    this.message = message;
  };

  setTimeout(function(){
     throw new CustomError('this will make it through!');
  });

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions