Class: Resque::Failure::Hoptoad
- Defined in:
- lib/resque/failure/hoptoad.rb
Overview
A Failure backend that sends exceptions raised by jobs to Hoptoad.
To use it, put this code in an initializer, Rake task, or wherever:
require 'resque/failure/hoptoad'
Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Resque::Failure::Hoptoad]
Resque::Failure.backend = Resque::Failure::Multiple
Once you’ve configured resque to use the Hoptoad failure backend, you’ll want to setup an initializer to configure the Hoptoad.
HoptoadNotifier.configure do |config|
config.api_key = 'your_key_here'
end For more information see github.com/thoughtbot/hoptoad_notifier
Instance Attribute Summary
Attributes inherited from Base
#exception, #payload, #queue, #worker
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
all, clear, #initialize, #log, remove, requeue, search_count, search_results, url
Constructor Details
This class inherits a constructor from Resque::Failure::Base
Class Method Details
.configure(&block) ⇒ Object
26 27 28 29 |
# File 'lib/resque/failure/hoptoad.rb', line 26 def self.configure(&block) Resque::Failure.backend = self HoptoadNotifier.configure(&block) end |
.count ⇒ Object
31 32 33 34 35 |
# File 'lib/resque/failure/hoptoad.rb', line 31 def self.count # We can't get the total # of errors from Hoptoad so we fake it # by asking Resque how many errors it has seen. Stat[:failed] end |
Instance Method Details
#save ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/resque/failure/hoptoad.rb', line 37 def save HoptoadNotifier.notify_or_ignore(exception, :parameters => { :payload_class => payload['class'].to_s, :payload_args => payload['args'].inspect } ) end |