Consider allowing custom failure when timeout exceeded
Ex:
Timeout<Object> timeout = Timeout.of(Duration.ofSeconds(10))
.withFailure(() -> new ConnectionTimeoutException());
Failsafe.with(timeout).run(this::connect);
as opposed to using a Fallback:
Timeout<Object> timeout = Timeout.of(Duration.ofSeconds(10));
Fallback<Object> fallback = Fallback.ofException(e -> new ConnectionTimeoutException())
.handle(TimeoutException.class);
Failsafe.with(fallback, timeout).run(this::connect);
Registering a Fallback that acts upon a TimeoutExceededExcecption doesn't work?
Yep that would be the current approach. I'm wondering if it's worth doing something more convenient though.
It's based on existing features and works exactly like any other fallback. I like it.
On Wed, 29 Jan 2020, 17:01 Jonathan Halterman, [email protected] wrote:
Yep that would be the current approach. I'm wondering if it's worth doing something more convenient though.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jhalterman/failsafe/issues/225?email_source=notifications&email_token=AADI7HOBAFJQNH35UXODRY3RAGR6PA5CNFSM4KM2WAAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKHXRNQ#issuecomment-579827894, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADI7HOKKC7YF4ODBOARQETRAGR6PANCNFSM4KM2WAAA .
Updated the OP to give some clearer code level examples of what this means.
Allowing something like this could also enhance RetryPolicy #202 ?