Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A delayed_job plugin to automatically notify Bugsnag (https://bugsnag.com) of exceptions.
module Delayed
module Plugins
class Bugsnag < Plugin
module Notify
def error(job, error)
::Bugsnag.auto_notify(error)
super
end
end
callbacks do |lifecycle|
lifecycle.before(:invoke_job) do |job|
payload = job.payload_object
payload = payload.object if payload.is_a? Delayed::PerformableMethod
payload.extend Notify
end
end
end
end
end
Delayed::Worker.plugins << Delayed::Plugins::Bugsnag
@maletor

This comment has been minimized.

Copy link

maletor commented Oct 8, 2013

super if defined?(super)

@brega

This comment has been minimized.

Copy link

brega commented Mar 7, 2014

👍

@timdiggins

This comment has been minimized.

Copy link

timdiggins commented Dec 18, 2014

I think it would be simpler and cleaner to use the 'around' hook rather than extending the payload. See my fork: https://gist.github.com/red56/190403991c3a98c0f0c6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.