retriable
retriable copied to clipboard
Allow not to retry some exceptions
This is very useful when you want to retry a lot of types of exceptions, except for, let's say, one.
And to not list all of them, you can just type :on
with :not
.
class UnreliableServiceException < StandardError; end
class ServiceUnavailableException < UnreliableServiceException; end
class LimitExceededException < UnreliableServiceException; end
# ... 10 more exception classes...
class AccountExpiredException < UnreliableServiceException; end
Retriable.retriable(on: UnreliableServiceException, not: AccountExpiredException) do
# do something
end
I think this is a good idea!