rhuffman / re-retrying

A Java library to allow for the creation of configurable retrying strategies for an arbitrary function call, such as something that communicates with a remote service with flaky uptime.
Apache License 2.0
35 stars 6 forks source link

Do not wrap the last exception thrown from the Callable in a RetryException #23

Closed rhuffman closed 6 years ago

rhuffman commented 6 years ago

If retrying fails, and the last attempt ends with an exception, then the exception should be propagated directly instead of wrapping it in a RetryException. This would make the caller's exception handling simpler. As part of this we should add a call method that does not throw a RetryException or any checked exception, thus enabling the user to completely eliminate checked exception handling.

rhuffman commented 6 years ago

Fixed in commit 45393bc on a branch, but leaving open until merged to master.

rhuffman commented 6 years ago

The After further consideration I am not implementing this. I think it is better to have the call method declare explicitly RetryException and InterruptedException, and always throw RetryException if the underlying call results in an exception. That avoids the generic "throws Exception" on the call method.