Skip to content

Conversation

Gaibhne
Copy link

@Gaibhne Gaibhne commented Feb 10, 2020

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.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.8%) to 90.593% when pulling 1dc0c8d on Gaibhne:master into 7f411c6 on jhalterman:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants