Customizing Error Grouping

Honeybadger groups similar exceptions together using rules which we've found to work the best in most cases. We use this information to construct a "fingerprint" of the exception.

The default information we use to group errors is:

  1. The first line of the stack trace otherwise
  2. The name of the error
  3. The component/controller name (if configured)

Exceptions with the same fingerprint are treated as the same error in Honeybadger.

Grouping by Component

If you have components that you'd prefer to monitor separately, a quick way to get custom error grouping is to specify a component which errors on the current page belong to:

Honeybadger.configure({
  // ...
  component: 'users',
  action: 'index'
});

The action is optional, and does not affect grouping. In Rails, for instance, the component and action could map to the controller and action names, respectively.

You can also specify the component (and action) when reporting caught errors:

Honeybadger.notify(error, {
  component: 'myComponent'
});

Creating Your Own Fingerprints

You can also create your own fingerprints by assigning a unique string to the fingerprint option. Errors which have the same fingerprint will be grouped, while Honeybadger's default fingerprint will be ignored.

To calculate a fingerprint when reporting caught errors:

Honeybadger.notify(err, {
  fingerprint: 'my unique fingerprint'
});

To calculate a fingerprint for all errors (even uncaught ones), use a beforeNotify handler:

Honeybadger.beforeNotify(function(notice) {
  notice.fingerprint = calculateFingerprint(notice);
});

In this example, the function calculateFingerprint should use the properties on notice to generate a string that is unique for each type of error.


The following notice properties are available in beforeNotify handlers:

  • stack - The stack trace
  • name - The exception class name
  • message - The error message
  • url - The current url
  • projectRoot - The root url
  • environment - Name of the environment. example: "production"
  • component - Similar to a rails controller name. example: "users"
  • action - Similar to a rails action name. example: "create"
  • fingerprint - A unique fingerprint, used to customize grouping of errors in Honeybadger.
  • context - The context object.
  • params - An object of request parameters.
  • cookies - An object of cookie key/values. May also be sent as a string in the document.cookie "foo=bar;bar=baz" format.