Reporting Errors

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

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

Reporting errors without an 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:

python
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

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:

python
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:

Parameter Type Required Description
exception Exception * An instance of an exception
error_class str ** A string representation of a class name
error_message str ** An error message
fingerprint str No A unique identifier used to group related errors together
context dict No A dictionary containing additional context information
tags list[str] No A 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.