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



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

def initialize(middleware)
  @middleware = middleware
end

Instance Method Details

#call(report) ⇒ Object



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

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