Reporting Errors
Use Honeybadger.notify(exception)
to send any exception to Honeybadger. For
example, to notify Honeybadger of a rescued exception without re-raising:
begin
fail 'oops'
rescue => exception
Honeybadger.notify(exception)
end
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 an error message:
Honeybadger.notify("Something is wrong here")
The error's class name will default to "Notice", and a backtrace will be
generated for you from the location in your code where Honeybadger.notify
was
called.
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 a second options
Hash
to Honeybadger.notify
.
For example, building on the example in Reporting errors without an exception, you could override the default class name:
Honeybadger.notify("Something is wrong here", class_name: "MyError")
These are all the available options you can pass to Honeybadger.notify
:
Option name | Description | Default value |
---|---|---|
:error_message |
The String error message. |
nil |
:error_class |
The String class name of the error. |
"Notice" |
:backtrace |
The Array backtrace of the error. |
nil |
:fingerprint |
The String grouping fingerprint of the exception. |
nil |
:force |
Always report the exception when true , even when ignored. |
false |
:tags |
The String comma-separated list of tags. |
nil |
:context |
The Hash context to associate with the exception. |
nil |
:controller |
The String controller name (such as a Rails controller). |
nil |
:action |
The String action name (such as a Rails controller action). |
nil |
:parameters |
The Hash HTTP request paramaters. |
nil |
:session |
The Hash HTTP request session. |
nil |
:url |
The String HTTP request URL. |
nil |