Class: Airbrake::Sidekiq::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/airbrake/sidekiq.rb

Overview

Provides integration with Sidekiq v2+.

Instance Method Summary collapse

Instance Method Details

#call(_worker, context, _queue, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/airbrake/sidekiq.rb', line 9

def call(_worker, context, _queue, &block)
  timing = Airbrake::Benchmark.measure(&block)
rescue Exception => exception # rubocop:disable Lint/RescueException
  notify_airbrake(exception, context)
  Airbrake.notify_queue(
    queue: context['class'],
    error_count: 1,
    timing: 0.01,
  )
  raise exception
else
  Airbrake.notify_queue(
    queue: context['class'],
    error_count: 0,
    timing: timing,
  )
end