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 callbacks

An error notification can be modified to add or remove fields, or cancelled altogether by returning False from a callback function. To get started, you can register a function to be used as the before_notify callback:

def callback(notification):

    # if you return False, the notification will not be sent to
    # Bugsnag. (see ignore_classes for simple cases)
    if isinstance(notification.exception, KeyboardInterrupt):
        return False

    # You can set properties of the notification and
    # add your own custom meta-data.
    notification.user = {"id": current_user.id,
      "name": current_user.name,
      "email": current_user.email}
    notification.add_tab("account", {"paying": current_user.acccount.is_paying()})

# Call `callback` before every notification
bugsnag.before_notify(callback)