Sha256: 5c42a80ab2ff31eed23613142925daf7719a2fe3af52f8304adf1324460e7d47

Contents?: true

Size: 660 Bytes

Versions: 15

Compression:

Stored size: 660 Bytes

Contents

module Bugsnag::Middleware
  ##
  # Determines if the exception should be ignored based on the configured
  # `ignore_classes`
  class IgnoreErrorClass
    def initialize(bugsnag)
      @bugsnag = bugsnag
    end

    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
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
bugsnag-6.13.1 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.13.0 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.12.2 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.12.1 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.12.0 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.11.1 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.11.0 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.10.0 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.9.0 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.8.0 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.7.3 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.7.2 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.7.1 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.7.0 lib/bugsnag/middleware/ignore_error_class.rb
bugsnag-6.6.4 lib/bugsnag/middleware/ignore_error_class.rb