Sha256: 6b437f9e7437acf10506f0240e7df7fd32b651355ab1904f5929b5f5d9e5682c

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 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

1 entries across 1 versions & 1 rubygems

Version Path
exception-track-1.3.0 lib/exception_notification/sidekiq.rb