Error reporting when sending emails with delayed_job

前端 未结 2 2220
长情又很酷
长情又很酷 2021-02-20 15:12

What\'s the proper way to get error reports, when using a tool like AirBrake or ExceptionNotifier from mailing delayed jobs?

I tried to creating my own delayed job class

2条回答
  •  一向
    一向 (楼主)
    2021-02-20 15:37

    First, a module for inclusion in mailer and, possibly, other delayed jobs:

    module Delayed
      module Airbrake
        # Send error via Airbrake
        def error(job, e)
          ::Airbrake.notify(e, :component => job.name, :action => 'perform', :parameters => {:job => job.inspect})
        end
     end
    

    end

    then include it:

    Delayed::PerformableMailer.send(:include, Delayed::Airbrake)
    

提交回复
热议问题