Please sign in to comment.
Match exception instance against retry_exceptions
This allows to 'tag' exceptions with a module instead of having to wrap them in custom exception classes, which is useful when you want to keep the original exception for logging and diagnosis after the retry limit was exceeded. Using the === operator makes the matching work the same as the ruby rescue clause. Example: module TransientError; end def foo ... rescue Timeout::Error => e raise e.extend(TransientError) end class SomeJob def self.retry_exceptions [TransientError] end ... end The old behaviour of the public method retry_exception? so that you can alternatively pass an exception class instead of an exception instance to it is kept but documented as deprecated. This is a reworked version of this commit: til@cfa3970
- Loading branch information...
Showing with 32 additions and 5 deletions.