module Delayed::Plugins::AirbrakeExtended::Plugin::Notify
Public Instance Methods
error(job, exception)
click to toggle source
Calls superclass method
# File lib/patches/delayed_plugin.rb, line 4 def error(job, exception) # rescue if ExceptionNotifier fails for some reason begin # Default is to include the job_id params = {job_id: job.id} # But also include any instance variables set in the exception itself. # # The is the heart of things. I recommend using custom exception classes # which take the objects being worked on when the erorr is raised, and # stores them as instance variables. This means when an error occurs, you # get to see exactly which instance of a model was being worked on, and # exactly what that hash of updates consisted of. Much easier than just the # line number and message, or having to write custom begin/rescue/notifiy's # everywhere. # params.merge!(error.airbrake_params) if error.respond_to? :airbrake_params puts "ERROR DETECTED -> Airbrake: #{error.inspect}", "WITH PARAMS: #{params.inspect}" Airbrake.notify_or_ignore(error, parameters: params) rescue Exception => e Rails.logger.error "ExceptionNotifier failed: #{e.class.name}: #{e.message}" e.backtrace.each do |f| Rails.logger.error " #{f}" end Rails.logger.flush end super if defined?(super) end