guava-retrying icon indicating copy to clipboard operation
guava-retrying copied to clipboard

Additional criteria: .retryIfCause(Predicate<Throwable>), .retryIfCauseOfType(Class<? extends Throwable>)

Open ceefour opened this issue 10 years ago • 0 comments
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:

  1. .retryIfCause(Predicate<Throwable>)
  2. .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.

ceefour avatar Dec 04 '14 07:12 ceefour