Sha256: e11ffb9ed1e3f851d5fdccabb8749ac2e9e784c1f7e3ea6c4403a9a539230a8c

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

require 'sidekiq'

# Note: this class is only needed for Sidekiq version < 3.
module ExceptionNotification
  class Sidekiq
    def call(_worker, msg, _queue)
      yield
    rescue Exception => exception
      ExceptionNotifier.notify_exception(exception, data: { sidekiq: msg })
      raise exception
    end
  end
end

if ::Sidekiq::VERSION < '3'
  ::Sidekiq.configure_server do |config|
    config.server_middleware do |chain|
      chain.add ::ExceptionNotification::Sidekiq
    end
  end
else
  ::Sidekiq.configure_server do |config|
    config.error_handlers << proc do |ex, context|
      ExceptionNotifier.notify_exception(ex, data: { sidekiq: context })
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exception_notification-4.4.0 lib/exception_notification/sidekiq.rb