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 Seq.peekThrowable(Consumer<Throwable>) #91

Open
lukaseder opened this issue Jun 1, 2015 · 4 comments
Open

Add Seq.peekThrowable(Consumer<Throwable>) #91

lukaseder opened this issue Jun 1, 2015 · 4 comments

Comments

@lukaseder
Copy link
Member

lukaseder commented Jun 1, 2015

There is currently no fluent way of handling exceptions in a Stream. While Stream extends AutoCloseable and provides an onClose(Runnable) hook for actions that are to be taken before the actual closing, there is no such thing for exceptions.

We should add an peekThrowable(Consumer<Throwable>) hook that allows Consumers to be added to consume all sorts of exceptions that may occur.

The actual API is not yet fully defined and may differ, e.g. by taking inspiration from the Try monad

@tkroman
Copy link
Contributor

tkroman commented Sep 2, 2015

@lukaseder, do you have any thoughts on this? I believe, CompletableFuture's API is a rather well designed one, although a little bloated with (maybe) too much methods responsible for handling the computation result, so maybe this feature's implementation could borrow something from there?

@lukaseder
Copy link
Member Author

I haven't thought all situations through yet. I'm afraid that it might not be a very good idea to implement such a method in a Stream. Perhaps, there are situations where exceptions will escape...

@lukaseder
Copy link
Member Author

An implementation suggestion was made by @tlinkowski in #299

@lukaseder lukaseder reopened this Apr 27, 2017
@lukaseder lukaseder changed the title Add Seq.onFailure(Consumer<Throwable>) Add Seq.peekThrowable(Consumer<Throwable>) May 16, 2017
tlinkowski pushed a commit to tlinkowski/jOOL that referenced this issue May 17, 2017
@lukaseder lukaseder modified the milestones: Version 0.9.13, On Hold May 17, 2017
@lukaseder
Copy link
Member Author

Implemented through #315

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

No branches or pull requests

2 participants