I’d like ExceptionNotifier to send out an email when an exception happens in a delayed job, just like for other exceptions. How can I achieve that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I do this with Rails 3.2.6, delayed_job 3.0.3 and exception_notification 2.6.1 gem
It’s probably a good idea to load this code in all environments to catch errors after bundle update etc before they reach production. I do this by having a
config/initializers/delayed_job.rbfile but you could duplicate the code for eachconfig/environments/*environment.Another tip is to tune the delayed job config a bit as default you may get a lot of duplicate exception mails when job fails.
Update I had some problems with the
delayed_jobdaemon silently exiting and it turned out to be whenExceptionNotifierfails to send mail and no one rescued the exception. Now the code rescues and log them.