class Bugsnag::Middleware::ClassifyError

Sets the severity to info for low-importance errors

Constants

INFO_CLASSES

Public Class Methods

new(bugsnag) click to toggle source
# File lib/bugsnag/middleware/classify_error.rb, line 20
def initialize(bugsnag)
  @bugsnag = bugsnag
end

Public Instance Methods

call(report) click to toggle source
# File lib/bugsnag/middleware/classify_error.rb, line 24
def call(report)
  report.raw_exceptions.each do |ex|

    ancestor_chain = ex.class.ancestors.select {
      |ancestor| ancestor.is_a?(Class)
    }.map {
      |ancestor| ancestor.to_s
    }

    INFO_CLASSES.each do |info_class|
      if ancestor_chain.include?(info_class)
        report.severity_reason = {
          :type => Bugsnag::Report::ERROR_CLASS,
          :attributes => {
            :errorClass => info_class
          }
        }
        report.severity = 'info'
        break
      end
    end
  end

  @bugsnag.call(report)
end