`exceptions_to_retry` does not retry child exceptions
dwbutler opened this issue · 2 comments
dwbutler commented
Hi, I'm running into an issue with retrying exceptions. I've added the following configuration to Rspec:
config.exceptions_to_retry = [Selenium::WebDriver::Error::WebDriverError]
The intention was to catch a whole bunch of Selenium errors that all descend from WebDriverError
. (A biggy is Selenium::WebDriver::Error::StaleElementReferenceError
). My expectation was that child exceptions would be caught and retried, similar to how Ruby's rescue
works.
Unfortunately, it appears that only specific error classes are retried, as indicated by this line:
https://github.com/NoRedInk/rspec-retry/blob/master/lib/rspec/retry.rb#L57
I propose replacing it with something like:
break unless exceptions_to_retry.any? do |exception_klass|
example.exception.class < exception_klass
end
michaelglass commented
Checks out. You wanna create a PR?