Class: Maze::BugsnagConfig::AssertErrorMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/maze/bugsnag_config.rb

Constant Summary collapse

IGNORE_CLASS_NAME =
'Test::Unit::AssertionFailedError'

Instance Method Summary collapse

Constructor Details

#initialize(middleware) ⇒ AssertErrorMiddleware

Returns a new instance of AssertErrorMiddleware.

Parameters:

  • middleware (#call)

    The next middleware to call



55
56
57
# File 'lib/maze/bugsnag_config.rb', line 55

def initialize(middleware)
  @middleware = middleware
end

Instance Method Details

#call(report) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/maze/bugsnag_config.rb', line 59

def call(report)
  # Only ignore automated notifies with assertion errors
  automated = report.unhandled

  class_match = report.raw_exceptions.any? do |ex|
    ex.class.name.eql?(IGNORE_CLASS_NAME)
  end

  report.ignore! if automated && class_match

  @middleware.call(report)
end