Reducing Noise

Honeybadger can ignore frequent/unwanted errors in order to reduce noise, limit bandwidth usage, or both.

Note: If you're uploading a source map (recommended!) be sure to check out Improving error grouping and linking to source code.

Ignoring errors

To ignore an error, return false from any Honeybadger.beforeNotify handler:

javascript
Honeybadger.beforeNotify(function(notice) { if (/third-party-domain/.test(notice.stack)) { return false; } });

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

Transient UnhandledPromiseRejectionWarning errors

Sometimes you might see UnhandledPromiseRejectionWarning errors that lack useful debugging information. This can happen for a variety of reasons that don't actually point to a problem in your application (perhaps from a crawler request that doesn't have a modern javascript implementation). In these cases adding a targeted filter can help reduce noise.

javascript
Honeybadger.beforeNotify(function(notice) { if (/UnhandledPromiseRejectionWarning: Unspecified reason/.test(notice.message)) { return false; } });

Limit bandwidth (browser only)

If your application is reporting too many errors (which could interfere with bandwidth constraints, or cause you to use up your monthly error volume too quickly), use the maxErrors configuration option:

javascript
Honeybadger.configure({ // ... maxErrors: 20 });

On each page load, errors will be sent to Honeybadger until the maxErrors threshold has been reached. In the above example, 20 errors will be reported per page load.

Use Honeybadger.resetMaxErrors() to reset the counter between page loads (useful for single page apps which don't typically reload the page often).

Turn off automatic error reporting

You can also turn off automatic error reporting entirely. If you do this, you'll need to report errors manually using Honeybadger.notify. Only do this if you really know what you're doing, because you will any miss unhandled errors that you don't intentionally catch and report to Honeybadger:

js
Honeybadger.configure({ // Your existing config enableUncaught: false, enableUnhandledRejection: false });