Skip to content

Instantly share code, notes, and snippets.

@gotmayonase
Created April 27, 2012 20:13
Show Gist options
  • Save gotmayonase/2512566 to your computer and use it in GitHub Desktop.
Save gotmayonase/2512566 to your computer and use it in GitHub Desktop.
module Delayed
module Plugins
class Airbrake < Plugin
callbacks do |lifecycle|
lifecycle.after(:failure) do |worker, job|
backtrace = job.last_error.split("\n")
::Airbrake.notify_or_ignore(
:error_class => "Failed Delayed Job",
:error_message => backtrace.shift,
:backtrace => backtrace,
:parameters => {
:class => job.payload_object.object.class.to_s,
:method => job.payload_object.method_name.to_s,
:args => job.payload_object.args,
:object => job.payload_object.object.inspect
}
)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment