Module: Bugsnag::Rails::ActiveRecordRescue

Defined in:
lib/bugsnag/integrations/rails/active_record_rescue.rb

Constant Summary collapse

KINDS =
[:commit, :rollback].freeze
FRAMEWORK_ATTRIBUTES =
{
  :framework => "Rails"
}

Instance Method Summary collapse

Instance Method Details

#run_callbacks(kind, *args, &block) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bugsnag/integrations/rails/active_record_rescue.rb', line 8

def run_callbacks(kind, *args, &block)
  if KINDS.include?(kind)
    begin
      super
    rescue StandardError => exception
      # This exception will NOT be escalated, so notify it here.
      Bugsnag.notify(exception, true) do |report|
        report.severity = "error"
        report.severity_reason = {
          :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE,
          :attributes => FRAMEWORK_ATTRIBUTES
        }
      end
      raise
    end
  else
    # Let the post process handle the exception
    super
  end
end