class Airbrake::Sidekiq::ErrorHandler
Provides integration with Sidekiq 2, 4, 5.
Public Instance Methods
call(_worker, context, _queue) { || ... }
click to toggle source
rubocop:disable Lint/RescueException
# File lib/airbrake/sidekiq.rb, line 7 def call(_worker, context, _queue) yield rescue Exception => exception notify_airbrake(exception, context) raise exception end
Private Instance Methods
action(context)
click to toggle source
@return [String] job's name. When ActiveJob is present, retrieve
job_class. When used directly, use worker's name
# File lib/airbrake/sidekiq.rb, line 27 def action(context) klass = context['class'] || context[:job] && context[:job]['class'] return klass unless context[:job] && context[:job]['args'].first.is_a?(Hash) return klass unless (job_class = context[:job]['args'].first['job_class']) job_class end
notify_airbrake(exception, context)
click to toggle source
rubocop:enable Lint/RescueException
# File lib/airbrake/sidekiq.rb, line 17 def notify_airbrake(exception, context) Airbrake.notify(exception, context) do |notice| notice[:context][:component] = 'sidekiq' notice[:context][:action] = action(context) end end