Skip to content

Instantly share code, notes, and snippets.

@brianjlandau
Created March 14, 2011 05:50
Show Gist options
  • Select an option

  • Save brianjlandau/868826 to your computer and use it in GitHub Desktop.

Select an option

Save brianjlandau/868826 to your computer and use it in GitHub Desktop.
require 'hoptoad_notifier'
require 'resque/failure/base'
module Resque
module Failure
# 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/simpler_hoptoad'
# Resque::Failure.backend = Resque::Failure::SimplerHoptoad
class SimplerHoptoad < Base
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
def self.url
'YOUR_HOPTOAD_PROJECT_URL'
end
def save
payload['args'] = payload['args'].inspect
HoptoadNotifier.notify(exception, {
:component => payload["class"].to_s,
:url => queue.to_s,
:parameters => {
:queue => queue,
:payload => payload
}
})
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment