Skip to content

Instantly share code, notes, and snippets.

@coryvirok
Last active June 28, 2017 22:06
Show Gist options
  • Save coryvirok/2bd77c35db1ab758afe5 to your computer and use it in GitHub Desktop.
Save coryvirok/2bd77c35db1ab758afe5 to your computer and use it in GitHub Desktop.
function ignoreRemoteUncaught(isUncaught, args, payload) {
try {
var filename = payload.data.body.trace.frames[0].filename;
if (isUncaught && !filename.match(/^https?:\/\/www\.mycompany\.com/)) {
// Ignore uncaught errors that are not from www.mycompany.com.
return true;
}
} catch (e) {
// Most likely there was no filename or the frame doesn't exist.
}
return false;
}
Rollbar.configure({checkIgnore: ignoreRemoteUncaught});
// or...
_rollbarConfig({
// ...
checkIgnore: ignoreRemoteUncaught
});
@and-megan
Copy link

UPDATE: You no longer need to use the data key. The filename should be found like this:
var filename = payload.body.trace.frames[0].filename;

https://gist.github.com/and-megan/d234875541e88f4a8185adecb4b79734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment