Skip to content
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

DEV UI - Enable error handling for JSON RPC client and normal requests-response cases #33648

Merged

Conversation

michalvavrik
Copy link
Member

@michalvavrik michalvavrik commented May 27, 2023

JSON RPC client doesn't take into consideration that failed requests doesn't have response-type (more precisely, it's data property contains error object and not response object), which means requests throws error on devUiResponse being undefined (JS analogy to NPE) here

This happens (at the very least) when my JSON RPC Service returns failed Uni

public class MyJsonRpcService {

 public Uni<String> fail() {
   return Uni.createFrom().failure(new RuntimeException());
 }

}

and on client side, Promise then method or catch are never called. In practice, it means if I want to provide error handling, I have to introduce wrapper that contains actual response and error object and make sure Uni is never failed.

I'd rather do this

this.jsonRpc
            .fail()
            .then(response => {
                notifier....
            })
            .catch(error => {
               notifier....
            });

@phillip-kruger I need to provide error handling for #32031 as we have external requests to OIDC providers, but please let me know if you want me to open issue and handle it yourself. I only added here handling of normal request-responses that fails as that's what I need. Thanks!

@quarkus-bot

This comment has been minimized.

Copy link
Member

@phillip-kruger phillip-kruger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice ! Thanks

@quarkus-bot
Copy link

quarkus-bot bot commented May 29, 2023

✔️ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

@phillip-kruger phillip-kruger merged commit 588f287 into quarkusio:main May 29, 2023
@quarkus-bot quarkus-bot bot added this to the 3.2 - main milestone May 29, 2023
@michalvavrik michalvavrik deleted the dev-ui-jsonrpc-error-handling branch May 29, 2023 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants