failsafe
failsafe copied to clipboard
Add non-wrapped exceptions to get()
We talked about this a few days ago; basically, it allows you to properly catch an Exception thrown from code you call in a lambda, like so:
public void testCheckedException() throws IOException {
RetryPolicy<Object> retryPolicy = new RetryPolicy<>();
Failsafe.with(retryPolicy).getWithException(() -> {
throw new IOException();
});
}
or
RetryPolicy<Object> retryPolicy = new RetryPolicy<>();
try {
Failsafe.with(retryPolicy).getWithException(() -> {
throw new IOException();
});
} catch (IOException e) {
e.printStackTrace(); // this is horrible practice
}
Obviously the code is not intended to be accepted like this, it's just a POC.