Sha256: 5e7c4fe15d767e84b21581fa8ba311d42dacccb2dfcb5d057d783e200e522e89

Contents?: true

Size: 1000 Bytes

Versions: 2

Compression:

Stored size: 1000 Bytes

Contents

module Honeybadger
  module Integrations
    module DelayedJob
      class Plugin < ::Delayed::Plugins::Plugin
        callbacks do |lifecycle|
          lifecycle.around(:invoke_job) do |job, *args, &block|
            begin
              block.call(job, *args)
            rescue Exception => error
              ::Honeybadger.notify_or_ignore(
                :error_class   => error.class.name,
                :error_message => "#{ error.class.name }: #{ error.message }",
                :backtrace     => error.backtrace,
                  :context       => {
                  :job_id        => job.id,
                  :handler       => job.handler,
                  :last_error    => job.last_error,
                  :attempts      => job.attempts,
                  :queue         => job.queue
                }
              )
              raise error
            ensure
              ::Honeybadger.context.clear!
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
honeybadger-1.12.0.beta3 lib/honeybadger/integrations/delayed_job/plugin.rb
honeybadger-1.12.0.beta2 lib/honeybadger/integrations/delayed_job/plugin.rb