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

hotfix: graphql connection error handler #4523

Merged

Conversation

anwarulislam
Copy link
Member

@anwarulislam anwarulislam commented Nov 7, 2024

This pull request fixes the error handling for GraphQL connections. It adds a new error message for HTTP errors and updates the connection state to "ERROR" when an HTTP error occurs.

Context: Previously, attempting to send a request would toggle the connection state reflecting in the Connect button. However, the schema fetch doesn't happen, and the request goes through regardless of whether the introspection attempt fails. With #4516, the schema fetch attempt takes place before sending a request and a failure in this phase would affect the overall request execution flow. With the proposed changes, the introspection query (schema fetch) failing with a non-200 status code is accounted for with relevant error handlers ensuring the request execution goes through even if the schema fetch attempt fails.

Copy link
Member

@jamesgeorge007 jamesgeorge007 left a comment

Choose a reason for hiding this comment

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

If the introspection attempt fails on the active endpoint with a non-Agent (given Agent is registered) interceptor, the Connect button goes to an infinite loading state.

@jamesgeorge007 jamesgeorge007 changed the base branch from next to patch November 8, 2024 09:03
Copy link
Member

@jamesgeorge007 jamesgeorge007 left a comment

Choose a reason for hiding this comment

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

  • The Browser extension is not installed and set as the active interceptor, the corresponding error state isn't displayed in the response section.

    image

  • For the error toast displayed when the introspection attempt fails while attempting to connect, we'll have to exclude it for the case when Browser extension is the active interceptor where the message displayed says Heading not found. Also, since a connection attempt is performed while sending a request, currently it results in an error toast due to the introspection query failing following a success toast saying the query succeeded in the given time frame and might not be necessary in such a case.

@jamesgeorge007 jamesgeorge007 merged commit e1fbe68 into hoppscotch:patch Nov 12, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants