Reducing Noise
Sometimes there are errors that you would rather not send to Honeybadger because they are not actionable or are handled internally.
Ignoring errors by class name
By default Honeybadger will be notified when any error occurs. To override this
configuration in order not to send out errors to Honeybadger, set
excluded_exceptions
in honeybadger.configure
.
The excluded_exceptions
configuration accepts a list of exception class names
(as strings) to exclude:
from honeybadger import honeybadger
honeybadger.configure(excluded_exceptions=["ZeroDivisionError", "ValueError"])
Exceptions are skipped when the exception's class name is found in the
excluded_exceptions
list.
Dynamic ignoring errors with before_notify
For more complex scenarios, you can use a before_notify
handler to
conditionally ignore errors:
from honeybadger import honeybadger
def filter_errors(notice):
# Skip connection errors during maintenance windows
if notice.error_class == 'ConnectionError' and is_maintenance_mode():
return False
return notice
honeybadger.configure(before_notify=filter_errors)
Returning False
from the handler will skip the notification entirely.
For more information about configuring before_notify
and other options, see
Configuration.