-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
ListenableFuture: Exception thrown when a future was cancelled seems to be lost #6794
Comments
Our behavior follows the JDK's Come to think of it, Guava actually used to rethrow an It is interesting to think about attaching execution exceptions as suppressed exceptions of the The obvious way to serve only the debugging and monitoring use cases is to log, but we know that that's not always desirable: #2134. Another possibility is static state (#1336), which is probably less likely to be used by apps for non-debugging/monitoring use cases than a suppressed exception would be. But no one loves static state. Actually, if we're talking about (It's possible that some people who want a "cancellable task" would be interested in https://guava.dev/Service. Others might want to make their task catch and store any exception that occurs. Of course, that latter approach helps only after they realize that their exception is being swallowed in the first place. But a project could define a common library for it.) My guess is that, at the end of the day, we won't end up doing anything further about this in Guava. But it's worth keeping in my back of our minds. |
Thank you for the context. The use case I had was specific to |
When a
ListenableFuture
is canceled and the interrupted task threw an exception,exception thrown from the task does not seem to appear in the
CancellationException
as cause or as suppressed exception.Do I have a wrong expectation and is there another way to propagate failure during cancellation to the future?
The text was updated successfully, but these errors were encountered: