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

JS API Error handling #1086

Merged
merged 3 commits into from
Aug 19, 2021
Merged

Conversation

niloc132
Copy link
Member

Added basic error handling, but not proper reconnects or reauth. Three error types are handled for the main streams or polling calls:

  • auth failure which suggests either that the server was restarted or the session timed out somehow - in either case, a new auth is required to resume working
  • Code.INTERNAL, which our grpc-web client library will pass in cases where the response doesn't make sense (broken payloads)
  • Code.UNKNOWN, which our grpc-web client library will pass in cases where the transport doesn't seem to work (no response before connection died)

A new event was added, temporarily, to inform the UI that we are giving up if one of these happens, and the page needs to be reloaded. This will be removed when we have proper reconnect, and inform the UI again that the reconnect succeeded or failed.

Also modified a few errors being sent from the server to hopefully better reflect the intent of the gRPC status codes, and avoid using "INTERNAL" when "something bad" happens.

The UI will need a few small changes to handle this, and to handle a few cases where API calls can fail but not be registered in the UI.

Fixes #1065, but #730 needs to formally address this.

@niloc132
Copy link
Member Author

Extremely rough patch for @mofojed to finish up nicely in the UI niloc132/web-client-ui@e798052

@@ -65,6 +67,9 @@ static AuthTokenPromiseSupplier oneShot(ConnectToken initialToken) {
@JsProperty(namespace = "dh.QueryInfo")
public static final String EVENT_CONNECT = "connect";

@JsProperty(namespace = "dh.IdeConnection")
public static final String HACK_CONNECTION_FAILURE = "hack-connection-failure";
Copy link
Member

Choose a reason for hiding this comment

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

Why is this named hack-connection-failure? Why hack-?

Copy link
Member

@nbauernfeind nbauernfeind Aug 19, 2021

Choose a reason for hiding this comment

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

I believe 'hack' here is to make it blindly obvious this is a temporary work around to a bigger problem that Colin wants carte blanche to fix correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is temporary, until we have reconnect (#730) which will have this being removed. I wanted to draw a distinction between normal events or internal-only ones, but I'm open to some other way to do that.

I tried to summarize in the description above (and will make it part of the actual commit message), but the old reconnect events are probably what we will use for these cases once the api is smart enough to try reconnecting streams.

Copy link
Member

Choose a reason for hiding this comment

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

Okay cool, I've got a change to listen for these new errors pushed on my Application Mode PR: deephaven/web-client-ui#155

@niloc132 niloc132 merged commit 41cd9a3 into deephaven:main Aug 19, 2021
@niloc132 niloc132 deleted the 1065-grpc-error-handling branch August 19, 2021 16:59
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.

Table Errors are Ignored
3 participants