You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To avoid this and make the API a bit nicer, add a method to RetryException to get the last failed Attempt with a specific type:
// result has inferred type of Integervarresult = retryException.getLastFailedAttempt(Integer.class);
// or define the type explicitlyIntegerresult = retryException.getLastFailedAttempt(Integer.class);
Of course, the caller must know the actual type or else a ClassCastException is thrown, but that's just Java...
The text was updated successfully, but these errors were encountered:
* Add getLastFailedAttempt(Class<T> type) to RetryException
* Add reference to this method in API Note in getLastFailedAttempt()
Details:
Instead of just casting, check that the Attempt either:
1. does not contain a result (it contains an Exception)
2. contains a result that can be assigned to the specified type
If either the above conditions is true, then a cast is safe.
Define the function to throw IlegalStateException with a
descriptive message instead of just letting th JVM throw
a ClassCastException with no message.
Closes#224
Currently to get the result of the last failed attempt in a
RetryException
you need a cast:To avoid this and make the API a bit nicer, add a method to
RetryException
to get the last failedAttempt
with a specific type:Of course, the caller must know the actual type or else a
ClassCastException
is thrown, but that's just Java...The text was updated successfully, but these errors were encountered: