Skip to content

Commit

Permalink
Updated notifier documentation on manually sending notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Ferris committed Nov 24, 2009
1 parent 4916703 commit 8d69e4a
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions README.rdoc
Expand Up @@ -109,29 +109,27 @@ You can also pass a hash to notify_hoptoad method and store whatever you want, n
my_unpredicable_method(params)
rescue => e
HoptoadNotifier.notify(
:error_class => "Special Error",
:error_class => "Special Error",
:error_message => "Special Error: #{e.message}",
:request => { :params => params }
:parameters => params
)
end

While in your controllers you use the notify_hoptoad method, anywhere else in your code, use HoptoadNotifier.notify. Hoptoad will get all the information about the error itself. As for a hash, these are the keys you should pass:

* :error_class – Use this to group similar errors together. When Hoptoad catches an exception it sends the class name of that exception object.
* :error_message – This is the title of the error you see in the errors list. For exceptions it is "#{exception.class.name}: #{exception.message}"
* :request – While there are several ways to send additional data to Hoptoad, passing a Hash with :params key as :request as in the example above is the most common use case. When Hoptoad catches an exception in a controller, the actual HTTP client request is being sent using this key.
* :parameters – While there are several ways to send additional data to Hoptoad, passing a Hash as :parameters as in the example above is the most common use case. When Hoptoad catches an exception in a controller, the actual HTTP client request parameters are sent using this key.

Hoptoad merges the hash you pass with these default options:

def default_notice_options
{
:api_key => HoptoadNotifier.api_key,
:error_message => 'Notification',
:backtrace => caller,
:request => {},
:session => {}
}
end
{
:api_key => HoptoadNotifier.api_key,
:error_message => 'Notification',
:backtrace => caller,
:parameters => {},
:session => {}
}

You can override any of those parameters.

Expand Down

0 comments on commit 8d69e4a

Please sign in to comment.