There are a few corner cases where Mutiny cannot propagate an exception to a
Uni or a
Consider the following example:
Cancellable cancellable = Uni.createFrom() .emitter(this::emitter) .onCancellation().call(() -> Uni.createFrom().failure(new IOException("boom"))) .subscribe().with(this::onItem, this::onFailure); cancellable.cancel();
onCancellation().call(…) method is called when the
Uni subscription is cancelled.
Uni is failed with a
IOException, but since the subscription itself has been cancelled then there is no way to catch the exception.
By default Mutiny reports such dropped exceptions to the standard error stream along with the corresponding stack trace.
You can change how these exceptions are handled using
The following logs dropped exceptions to a logger:
Infrastructure.setDroppedExceptionHandler(err -> log(Level.SEVERE, "Mutiny dropped exception", err) );