Class: Maze::BugsnagConfig::AmbiguousErrorMiddleware

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

Constant Summary collapse

AMBIGUOUS_ERROR_CLASSES =
[
  'Selenium::WebDriver::Error::ServerError',
  'Selenium::WebDriver::Error::UnknownError'
]

Instance Method Summary collapse

Constructor Details

#initialize(middleware) ⇒ AmbiguousErrorMiddleware

Returns a new instance of AmbiguousErrorMiddleware.



79
80
81
# File 'lib/maze/bugsnag_config.rb', line 79

def initialize(middleware)
  @middleware = middleware
end

Instance Method Details

#call(report) ⇒ Object



83
84
85
86
87
88
89
90
# File 'lib/maze/bugsnag_config.rb', line 83

def call(report)
  first_ex = report.raw_exceptions.first
  if AMBIGUOUS_ERROR_CLASSES.include?(first_ex.class.name)
    report.grouping_hash = first_ex.class.name.to_s + first_ex.message.to_s
  end

  @middleware.call(report)
end