Skip to content

Reducing noise

View Markdown

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

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

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

Section titled “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.

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

Ignore browser extension errors (browser only)

Section titled “Ignore browser extension errors (browser only)”

Browser extensions injected into your page can throw errors that get reported to Honeybadger but have nothing to do with your application code. To filter these out, enable the ignoreBrowserExtensionErrors option:

Honeybadger.configure({
// ...
ignoreBrowserExtensionErrors: true,
});

When enabled, errors whose top stack frame originates from a browser extension URL (chrome-extension://, moz-extension://, safari-extension://, or safari-web-extension://) will be dropped before being sent to Honeybadger. Filtered errors do not count against maxErrors.

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:

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).

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:

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