Created
May 19, 2012 09:56
-
-
Save tsommer/2730303 to your computer and use it in GitHub Desktop.
Delayed Job exceptions with Airbrake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Handle errors with Airbrake | |
Delayed::Worker.class_eval do | |
def handle_failed_job_with_airbrake(job, error) | |
handle_failed_job_without_notification job, error | |
# rescue if Airbrake fails for some reason | |
begin | |
Airbrake.notify error | |
rescue Exception => e | |
Rails.logger.error "Airbrake failed: #{e.class.name}: #{e.message}" | |
Rails.logger.flush | |
end | |
end | |
alias_method_chain :handle_failed_job, :airbrake | |
end |
what is handle_failed_job_without_notification(job, error) ? just a placeholder ?
great question! I haven't looked at this piece of code for, well, 9 years 👍
I guess that it's a method provided by DelayedJob
.
This code hooked into the handle_failed_job
chain to loop in Airbrake
.
Note however, that the DelayedJob
version this was written for is also 9 years old, so the method might not exist anymore
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is handle_failed_job_without_notification(job, error) ? just a placeholder ?