-
Notifications
You must be signed in to change notification settings - Fork 123
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
CompletionStage exceptions leak into Mutiny API #179
Comments
So basically: Uni.createFrom().completionStage(() -> {
// ...
CompletionStage<X> stage = ...
})
// automatically added
.onFailure(CompletionException.class).apply(ce -> ce.getCause()); |
Actually, another approach (much better): private static <O> void forwardFromCompletionStage(CompletionStage<? extends O> stage,
UniSerializedSubscriber<? super O> subscriber) {
subscriber.onSubscribe(() -> stage.toCompletableFuture().cancel(false));
stage.whenComplete((res, fail) -> {
if (fail != null) {
if (fail instanceof CompletionException) {
subscriber.onFailure(fail.getCause());
} else {
subscriber.onFailure(fail);
}
} else {
subscriber.onItem(res);
}
});
} |
Yes that's what I had in mind. |
Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just got a CompletionException via the Mutiny API, which wraps any exception thrown inside a CompletionStage pipeline. I believe this is very annoying because it means I must wrap all my Uni into an exception mapper that unwraps these silly exception wrappers into their original causes.
Can we make sure the Mutiny API unwrap those when we create a
Uni
from aCompletionStage
?The text was updated successfully, but these errors were encountered: