Reporting handled errors

The bugsnag.notify() function asynchronously sends reports to Bugsnag. It accepts a JavaScript Error or a string as the first argument, and a callback or a map of reporting options as the second.

Reporting with a callback

The callback is invoked after notifying Bugsnag of an error. The callback has two arguments:

  • The error argument will contain any error received when trying to send the notification, and
  • the response object will contain the response received from Bugsnag
bugsnag.notify(new Error("Something went badly wrong"), (error, response) ->
  if error
    # Something went wrong
    # The notify worked

Reporting with an options map

The options map argument can be used to customize the report before it is sent to Bugsnag.


A string representing what was happening in your application at the time of the error. In Express/Connect apps, this will automatically be set to the URL of the current request:

bugsnag.notify(new Error("Something went badly wrong"), { context: "/users/new" })


Errors in your Bugsnag dashboard are grouped by their “error class”, to override the error class you can set errorName:

bugsnag.notify(new Error("Something went badly wrong"), { errorName: "BadError" })


If you need programmatical control over how the errors are grouped within Bugsnag, you can send a groupingHash to the notify call. This will ensure that Bugsnag groups all errors with the same groupingHash together:

bugsnag.notify(new Error("Something went badly wrong"), { groupingHash: "auth/create" })


Any extra data you want along with the exception report to Bugsnag. To do this just set other properties on the object, and you will see them as tabs in the error dashboard:

bugsnag.notify(new Error("Something went badly wrong"), {
  subsystem: {
    name: "Your subsystem name"


Severity is displayed in the dashboard and can be used to filter the error list. By default all crashes (or unhandled exceptions) are set to error and all Bugsnag.notify calls default to warning.

You can set the severity of an error in Bugsnag by including the severity option when notifying Bugsnag of the error:

bugsnag.notify(new Error("Non-fatal"), { severity: "error" })

Valid severities are error, warning and info.


A unique identifier for a user affected by this error. This could be any distinct identifier that makes sense for your application. In Express/Connect apps, this is automatically set to the ip address of the current request.

bugsnag.notify(new Error("Something went badly wrong"), { userId: "bob-hoskins" })