Sha256: 5f68ece0f6b6fc23e6ce6c5db73265852280f5d35925354c86b39120202ada38

Contents?: true

Size: 688 Bytes

Versions: 3

Compression:

Stored size: 688 Bytes

Contents

# frozen_string_literal: true

require 'sidekiq'

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

3 entries across 3 versions & 1 rubygems

Version Path
exception_notification-4.5.0 lib/exception_notification/sidekiq.rb
exception_notification-4.4.3 lib/exception_notification/sidekiq.rb
exception_notification-4.4.1 lib/exception_notification/sidekiq.rb