Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recover operator to Eval #1003

Closed
johnmcclean opened this issue Dec 17, 2018 · 2 comments
Closed

Add recover operator to Eval #1003

johnmcclean opened this issue Dec 17, 2018 · 2 comments
Milestone

Comments

@johnmcclean
Copy link
Member

johnmcclean commented Dec 17, 2018

Support general and specific error handling within a lazy or reactive Eval chain

Eval<T> recover(Function<Throwable,? extends T> value);
Eval<T> recover(Class<C> type, Function<? super C,? extends T> value)

E.g. with general error handling

Eval.now(100)
    .map(i->{throw new RuntimeException();})
    .recover(i->120)
    .get() //120

E.g. with specific error handling

Eval.now(100)
    .map(i->{throw ExceptionSoftener.softenException(IOException())})
    .recover(IOException.class,i->120)
    .get() //120
@johnmcclean johnmcclean added this to the 10.1.1 milestone Dec 17, 2018
@johnmcclean
Copy link
Member Author

Part of #986

@johnmcclean
Copy link
Member Author

Released in 10.1.1

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

No branches or pull requests

1 participant