class Airbrake::Shoryuken::ErrorHandler
Provides integration with Shoryuken
.
Public Instance Methods
call(worker, queue, _sqs_msg, body, &block)
click to toggle source
rubocop:disable Lint/RescueException
# File lib/airbrake/shoryuken.rb, line 8 def call(worker, queue, _sqs_msg, body, &block) timing = Airbrake::Benchmark.measure(&block) rescue Exception => exception notify_airbrake(exception, worker, queue, body) Airbrake.notify_queue( queue: worker.class.to_s, error_count: 1, timing: 0.01, ) raise exception else Airbrake.notify_queue( queue: worker.class.to_s, error_count: 0, timing: timing, ) end
Private Instance Methods
notice_context(queue, body)
click to toggle source
# File lib/airbrake/shoryuken.rb, line 36 def notice_context(queue, body) { queue: queue, body: body.is_a?(Array) ? { batch: body } : { body: body }, } end
notify_airbrake(exception, worker, queue, body)
click to toggle source
rubocop:enable Lint/RescueException
# File lib/airbrake/shoryuken.rb, line 29 def notify_airbrake(exception, worker, queue, body) Airbrake.notify(exception, notice_context(queue, body)) do |notice| notice[:context][:component] = 'shoryuken' notice[:context][:action] = worker.class.to_s end end