class Airbrake::Shoryuken::ErrorHandler

Provides integration with Shoryuken.

Public Instance Methods

call(worker, queue, _sqs_msg, body) { || ... } click to toggle source

rubocop:disable Lint/RescueException

# File lib/airbrake/shoryuken.rb, line 6
def call(worker, queue, _sqs_msg, body)
  yield
rescue Exception => exception
  notify_airbrake(exception, worker, queue, body)

  raise exception
end

Private Instance Methods

notice_context(queue, body) click to toggle source
# File lib/airbrake/shoryuken.rb, line 24
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 17
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