[cdi-dev] FireAsyncException question

Antoine Sabot-Durand antoine at sabot-durand.net
Mon Jul 13 08:36:50 EDT 2015

Good question Martin,

We added the FireAsyncException because users don't have hook on the
pipeline created internally by the vent dispatcher. If you call hand or
whenComplete on the completionStage returned by fireAsync() you'll get the
If you choose to continue the pipeline without checking the outcome of
fireAsync you'll get the CompletionException wrapping the

Now if you have suggestion to handle this differently, your input is
welcome. The EDR is here for that ;).


Le lun. 13 juil. 2015 à 13:04, Martin Kouba <mkouba at redhat.com> a écrit :

> Hi all,
> the CDI 2.0 EDR1, "10.5.1. Handling multiple exceptions thrown during an
> asynchronous event" currently states:
> "If an event is asynchronous, and an exception is thrown by any of its
> notified observers, the CompletionStage returned by fireAsync will
> complete exceptionally with FireAsyncException exception."
> And there's also an example of handle() method with lambda which gets
> FireAsyncException passed as an param. This looks good from the user
> point of view.
> However, what should happen if I use e.g. thenAccept() method? The
> CompletionStage API is clear:
> "Two method forms support processing whether the triggering... In all
> other cases, if a stage's computation terminates abruptly with an
> (unchecked) exception or error, then all dependent stages requiring its
> completion complete exceptionally as well, with a CompletionException
> holding the exception as its cause...". In other words,
> myEvent.fireAsync(...).thenAccept(...).exceptionally(...) should receive
> CompletionException and not FireAsyncException.
> This seems a bit inconsistent to me. Am I missing something?
> --
> Martin Kouba
> Software Engineer
> Red Hat, Czech Republic
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
> Note that for all code provided on this list, the provider licenses the
> code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20150713/cd95d0aa/attachment.html 

More information about the cdi-dev mailing list