Skip to content

Reporting errors

Use honeybadger.notify() to send errors to Honeybadger:

from honeybadger import honeybadger
try:
# Buggy code goes here
except Exception as exception:
honeybadger.notify(exception)

You can report any type of error to Honeybadger, not just exceptions. The simplest form is calling honeybadger.notify with a custom class and message:

from honeybadger import honeybadger
honeybadger.notify(
error_class='ValueError',
error_message='Something bad happened!'
)
# Or send a simple string message
honeybadger.notify("Something went wrong!")

Passing additional options to honeybadger.notify

Section titled “Passing additional options to honeybadger.notify”

In some cases you will want to override the defaults or add additional information to your error reports. To do so, you can pass more arguments to honeybadger.notify.

For example, you could add tags to a notification:

from honeybadger import honeybadger
honeybadger.notify(exception, tags=["my_custom_tag", "another_tag"])

These are all the available arguments you can pass to honeybadger.notify:

ParameterTypeRequiredDescription
exceptionException*An instance of an exception
error_classstr**A string representation of a class name
error_messagestr**An error message
fingerprintstrNoA unique identifier used to group related errors together
contextdictNoA dictionary containing additional context information
tagslist[str]NoA list of tags to associate with the error

* Either provide an exception object, OR both error_class and error_message.

** Required when not providing an exception object.

The honeybadger.notify() method returns a UUID string that uniquely identifies the error notification.