Sha256: 11301dff47d567a79825dbdfbd9a53573f40795b2d5de513187281e4ab76c50f
Contents?: true
Size: 975 Bytes
Versions: 2
Compression:
Stored size: 975 Bytes
Contents
module Airbrake module Sidekiq ## # Provides integration with Sidekiq 2 and Sidekiq 3. 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) notice = Airbrake.build_notice(exception, context) notice[:context][:component] = 'sidekiq' notice[:context][:action] = context['class'] Airbrake.notify(notice) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
airbrake-5.7.0 | lib/airbrake/sidekiq/error_handler.rb |
airbrake-5.7.0.rc.1 | lib/airbrake/sidekiq/error_handler.rb |