Class: ScoutApm::ErrorService::Sidekiq::SidekiqExceptionMiddleware

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

Instance Method Summary collapse

Instance Method Details

#call(worker, msg, queue) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/scout_apm/error_service/sidekiq.rb', line 55

def call(worker, msg, queue)
  yield
rescue => exception
  context = ScoutApm::Agent.instance.context

  # Bail out early, and reraise if the error is not interesting.
  if context.ignored_exceptions.ignored?(exception)
    raise
  end

  # Capture the error for further processing and shipping
  context.error_buffer.capture(
    exception,
    {
      :custom_params => msg,
      :custom_controller => msg["class"]
    }
  )

  # Finally, reraise
  raise exception
end