Sha256: 4b8cec3d2222ee67c99e9ac53c1836bde888f8a9a13fad1208916228d0a3648d
Contents?: true
Size: 1.57 KB
Versions: 3
Compression:
Stored size: 1.57 KB
Contents
if defined?(::Que) handler = proc do |error, job| begin job = job.dup # Make sure the original job object is not mutated. Bugsnag.auto_notify(error, { :severity_reason => { :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE, :attributes => { :framework => "Que" } } }) do |notification| job[:error_count] += 1 # If the job was scheduled using ActiveJob then unwrap the job details for clarity: if job[:job_class] == "ActiveJob::QueueAdapters::QueAdapter::JobWrapper" wrapped_job = job[:args].last wrapped_job = wrapped_job.each_with_object({}) { |(k, v), result| result[k.to_sym] = v } # Symbolize keys # Align key names with keys in `job` wrapped_job[:queue] = wrapped_job.delete(:queue_name) wrapped_job[:args] = wrapped_job.delete(:arguments) job.merge!(wrapper_job_class: job[:job_class], wrapper_job_id: job[:job_id]).merge!(wrapped_job) end notification.add_tab(:job, job) end rescue => e # Que supresses errors raised by its error handler to avoid killing the worker. Log them somewhere: Bugsnag.warn("Failed to notify Bugsnag of error in Que job (#{e.class}): #{e.message} \n#{e.backtrace[0..9].join("\n")}") raise end end if Que.respond_to?(:error_notifier=) Bugsnag.configuration.app_type ||= "que" Que.error_notifier = handler elsif Que.respond_to?(:error_handler=) Bugsnag.configuration.app_type ||= "que" Que.error_handler = handler end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bugsnag-5.5.0 | lib/bugsnag/que.rb |
bugsnag-5.4.1 | lib/bugsnag/que.rb |
bugsnag-5.4.0 | lib/bugsnag/que.rb |