Customizing error reports

In order to quickly reproduce and fix errors, it is often helpful to send additional application-specific diagnostic data to Bugsnag.

Adding a callback

If you’d like to add diagnostic data to every error report, or adjust error reports conditionally, you can add a callback which will be invoked each time a report will be sent:

Bugsnag.beforeNotify = function(payload) {
// Example: Only notify Bugsnag of errors in `app.js` or `vendor.js` files
var match = payload.file.match(/app\.js|vendor\.js/i);
return !!(match && match[0].length > 0);

If you want to halt the notification completely, return false from this function.

You can modify the payload or metaData by editing the parameters.

Bugsnag.beforeNotify = function(payload, metaData) {
// Filter out sensitive information
payload.url = "";