Class: Bugsnag::Middleware::IgnoreErrorClass Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/bugsnag/middleware/ignore_error_class.rb

Overview

Deprecated.

Use DiscardErrorClass instead

Determines if the exception should be ignored based on the configured `ignore_classes`

Instance Method Summary collapse

Constructor Details

#initialize(bugsnag) ⇒ IgnoreErrorClass

Returns a new instance of IgnoreErrorClass.


8
9
10
# File 'lib/bugsnag/middleware/ignore_error_class.rb', line 8

def initialize(bugsnag)
  @bugsnag = bugsnag
end

Instance Method Details

#call(report) ⇒ Object


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bugsnag/middleware/ignore_error_class.rb', line 12

def call(report)
  ignore_error_class = report.raw_exceptions.any? do |ex|
    ancestor_chain = ex.class.ancestors.select { |ancestor| ancestor.is_a?(Class) }.to_set

    report.configuration.ignore_classes.any? do |to_ignore|
      to_ignore.is_a?(Proc) ? to_ignore.call(ex) : ancestor_chain.include?(to_ignore)
    end
  end

  report.ignore! if ignore_error_class

  @bugsnag.call(report)
end