Sha256: 361488e372f4bfe405d7f4f2579455383417fe16282db1db86c41fda8b7a76fb
Contents?: true
Size: 947 Bytes
Versions: 6
Compression:
Stored size: 947 Bytes
Contents
module Airbrake module Sidekiq ## # Provides integration with Sidekiq 2, 4, 5. class ErrorHandler # rubocop:disable Lint/RescueException def call(_worker, context, _queue) yield rescue Exception => exception notify_airbrake(exception, context) raise exception end # rubocop:enable Lint/RescueException private def notify_airbrake(exception, context) Airbrake.notify(exception, context) do |notice| notice[:context][:component] = 'sidekiq' notice[:context][:action] = context['class'] end end end end end if Sidekiq::VERSION < '3' Sidekiq.configure_server do |config| config.server_middleware do |chain| chain.add(Airbrake::Sidekiq::ErrorHandler) end end else Sidekiq.configure_server do |config| config.error_handlers << Airbrake::Sidekiq::ErrorHandler.new.method(:notify_airbrake) end end
Version data entries
6 entries across 6 versions & 1 rubygems