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



53
54
55
# File 'lib/maze/bugsnag_config.rb', line 53

def initialize(middleware)
  @middleware = middleware
end

Instance Method Details

#call(report) ⇒ Object



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

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