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
Future.onSuccess swallowing exceptions #2705
Comments
Yes, this is expected behavior. Scala for example makes it more clear. There However, Scala does not completely swallow exceptions. They happen within another Thread and are printed to We might think about exposing exceptions to the error output stream. How does Java's Scala example: |
I think in this case we shouldn't just shallow the exception but some how log it, or make it noticeable to the developer. I am not familiar with the ForkJoinTask behavior but with CompletableFuture.thenAccept, if you get an exception on the running thread it gets propagated. Also I think we should update javadoc for onComplete, because right now is not stating that it may shallow the exceptions.
|
@galegofer That makes sense, thanks! |
Thanks to you for creating this amazing library, lets's hope Vavr 1.0.0 will see the light ;) |
Hi there,
I am having a kind of issue or misusage, when I do something like:
if any exceptions happens inside the .onSuccess it's not able to leave the block being the Future successful, and the caller not being able to realized about the situation.
But if you do:
In this case the exception is not lost, and we get the exception leaving the map block code.
My question is , is this the behavior expected for the .onSuccess method?, I understand the .onSuccess idea is mainly for log purposes, but I don't get why to eat the exceptions.
The text was updated successfully, but these errors were encountered: