Reducing noise
Honeybadger can ignore frequent/unwanted errors in order to reduce noise, limit bandwidth usage, or both.
Ignoring errors
Section titled “Ignoring errors”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 objectnotice.name- The exception class namenotice.message- The error messagenotice.url- The current urlnotice.projectRoot- The root urlnotice.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 Honeybadgernotice.context- The context objectnotice.tags- A string comma-separated list of tagsnotice.params- An object of request parametersnotice.session- An object of request session key/valuesnotice.headers- An object of request headersnotice.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; }});Limit bandwidth (browser only)
Section titled “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:
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
Section titled “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:
Honeybadger.configure({ // Your existing config
enableUncaught: false, enableUnhandledRejection: false,});