---
title: Customizing error grouping
description: Customize how errors are grouped in JavaScript applications to better organize and prioritize error reports.
url: https://docs.honeybadger.io/lib/javascript/errors/customizing-error-grouping/
---

Honeybadger groups similar exceptions together using rules which we’ve found to work the best in most cases. The default information we use to group errors is:

1. The file name, method name, and line number of the error’s location
2. The class name of the error
3. The component/controller name

We use this information to construct a “fingerprint” of the exception. Exceptions with the same fingerprint are treated as the same error in Honeybadger.

You can customize the grouping for each exception by changing the error class name, component, or stack trace—or by sending a custom fingerprint.

## 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:

```javascript
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](https://docs.honeybadger.io/lib/javascript/errors/reporting-errors/):

```javascript
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](https://docs.honeybadger.io/lib/javascript/errors/reporting-errors/):

```javascript
Honeybadger.notify(err, {
  fingerprint: "my unique fingerprint",
});
```

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

```javascript
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 `notice` objects:

* `notice.stack` - The stack trace (read only)
* `notice.backtrace` - The parsed backtrace object
* `notice.name` - The exception class name
* `notice.message` - The error message
* `notice.url` - The current url
* `notice.projectRoot` - The root url
* `notice.environment` - Name of the environment. example: “production”
* `notice.component` - Similar to a rails controller name. example: “users”
* `notice.action` - Similar to a rails action name. example: “create”
* `notice.fingerprint` - A unique fingerprint, used to customize grouping of errors in Honeybadger
* `notice.context` - The context object
* `notice.tags` - A string comma-separated list of tags
* `notice.params` - An object of request parameters
* `notice.session` - An object of request session key/values
* `notice.headers` - An object of request headers
* `notice.cookies` - An object of cookie key/values. May also be sent as a string in the document.cookie “foo=bar;bar=baz” format.

The following additional notice properties are available in `afterNotify` handlers:

* `notice.id` - The UUID of the error in Honeybadger

---

## Try Honeybadger for FREE

Intelligent logging, error tracking, and Just Enough APM™ in one dev-friendly platform. Find and fix problems before users notice.

[Start free trial](https://app.honeybadger.io/users/sign_up)

[See plans and pricing](https://www.honeybadger.io/plans/)
