guava-retrying
guava-retrying copied to clipboard
Additional criteria: .retryIfCause(Predicate<Throwable>), .retryIfCauseOfType(Class<? extends Throwable>)
trafficstars
First of all, @rholder thank you for creating/improving this very useful library! Exactly what I'm looking for :)
I'd like to suggest improvements:
.retryIfCause(Predicate<Throwable>).retryIfCauseOfType(Class<? extends Throwable>)
They work just like the normal counterparts, but use the output of Throwables.getCausalChain() on the thrown (topmost) exception.
It's possible to workaround this by catching the exception, doing Throwables.getCausalChain() processing then re-throwing a retryable Exception but with this improvement it'd be much more concise.