lib/raven/integrations/delayed_job.rb in sentry-raven-3.0.0 vs lib/raven/integrations/delayed_job.rb in sentry-raven-3.0.1

- old
+ new

@@ -6,23 +6,22 @@ callbacks do |lifecycle| lifecycle.around(:invoke_job) do |job, *args, &block| begin # Forward the call to the next callback in the callback chain block.call(job, *args) - - rescue Exception => exception + rescue Exception => e # Log error to Sentry extra = { :delayed_job => { - :id => job.id.to_s, - :priority => job.priority, - :attempts => job.attempts, - :run_at => job.run_at, - :locked_at => job.locked_at, - :locked_by => job.locked_by, - :queue => job.queue, - :created_at => job.created_at + :id => job.id.to_s, + :priority => job.priority, + :attempts => job.attempts, + :run_at => job.run_at, + :locked_at => job.locked_at, + :locked_by => job.locked_by, + :queue => job.queue, + :created_at => job.created_at } } # last_error can be nil extra[:last_error] = job.last_error[0...1000] if job.last_error # handlers are YAML objects in strings, we definitely can't @@ -30,19 +29,19 @@ extra[:handler] = job.handler[0...1000] if job.handler if job.respond_to?('payload_object') && job.payload_object.respond_to?('job_data') extra[:active_job] = job.payload_object.job_data end - ::Raven.capture_exception(exception, - :logger => 'delayed_job', - :tags => { + ::Raven.capture_exception(e, + :logger => 'delayed_job', + :tags => { :delayed_job_queue => job.queue, :delayed_job_id => job.id.to_s }, :extra => extra) # Make sure we propagate the failure! - raise exception + raise e ensure ::Raven::Context.clear! ::Raven::BreadcrumbBuffer.clear! end end