Skip to content

Instantly share code, notes, and snippets.

@brianr
Created January 10, 2014 19:10
Show Gist options
  • Save brianr/8360549 to your computer and use it in GitHub Desktop.
Save brianr/8360549 to your computer and use it in GitHub Desktop.
rollbar.js - ignore errors that aren't from a given domain (using rollbar.js version 0.10.8)
_rollbarConfig = {
"server.environment": "production",
// any other existing config...
checkIgnore: function(errMsg, file, line, col, err) {
// this function is called for all uncaught errors
// if it returns true, the error will be ignored
// instead of being reported to Rollbar.
if (file && !file.match(/^https?:\/\/www\.mycompany\.com/)) {
// has a filename, but filename (url) is not on www.mycompany.com.
// ignore.
return true;
}
// don't ignore anything else
return false;
}
}
@murbano83
Copy link

Sorry, thats doesn't work with last version:

checkIgnore: function(msg, url, lineNo, colNo, error) {
        if (url && !url.match(/^https?:\/\/www\.mycompany\.com/)) {
           // has a filename, but filename (url) is not on www.mycompany.com.
           // ignore.
           return true;
        }
        return false;
    },

I get this error:

TypeError: Object [object Array] has no method 'match'

col and err are undefined

How i can solve this problem?

Thanks.

@pkaeding
Copy link

pkaeding commented Jul 7, 2015

Since this gist seems to get all the google juice, the new way to do this is illustrated here: https://gist.github.com/coryvirok/2bd77c35db1ab758afe5

@and-megan
Copy link

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