guava-retrying
guava-retrying copied to clipboard
Turn RetryException into RuntimeException?
pls, I like when my exceptions explode all the way to the top liek in php. kthx
good thing there is a mechanism called javadoc to show which exceptions are thrown even if they are not checked.
I should probably point out that @dirkraft likes to troll me occasionally in lolspeak. He and I have actually had discussions about switching the checked RetryException over to a RuntimeException, but it hasn't really been a priority (as evidenced by the lack of movement on this...). Additional opinions/comments/rants for this module shifting RetryException over to a RuntimeException are welcome here.
I think the RetryException should stay checked because you always need to handle the case where all retries have failed.
But it's kind of annoying to be forced to handle the ExcecutionException. It will be rethrown or logged most of the times.
I like the checked exceptions too – if someone is going to the bother of using a Retrier, it's clear that they care about catching exceptions.
How about wrapping the cause of the ExecutionException in a RetryException? (and hide it completely from API consumers)
I, too, liked the checked exception.
Checked exceptions leave the retry pretty much outside of the clean lamda world. Java 8 is here, and unless a Runtime Exception is used I (and probably others) will prefer other retry solutions. Making assumptions over users desire of handling the exception is wrong, specially when the outcome is to force them to do the thing you might like.