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

Improve operation error handling #2184

Merged
merged 1 commit into from
May 23, 2022
Merged

Improve operation error handling #2184

merged 1 commit into from
May 23, 2022

Conversation

Desuuuu
Copy link
Contributor

@Desuuuu Desuuuu commented May 23, 2022

Currently, operation errors are not treated as protocol errors due to the lack of error code. They look like this:

{"errors":[{"message":"operation badOp not found"}],"data":null}

Or, if no operation is provided (e.g. the query is empty):

{"errors":[{"message":"operation  not found"}],"data":null}

This change aims to improve on this by:

  • Adding the GRAPHQL_VALIDATION_FAILED error code when an invalid operation name is provided, making transports treat it as a protocol error.
  • Returning a separate error when no operation is provided.

This was previously requested here: #1786

I also added 2 tests covering the changes to the executor.

@StevenACoffman
Copy link
Collaborator

Thanks! This is great! A lot of folks have struggled with less than helpful error messages in a variety of situations, so I really appreciate efforts to make it easier to understand when things go wrong.

@StevenACoffman StevenACoffman merged commit 7c95938 into 99designs:master May 23, 2022
@Desuuuu Desuuuu deleted the operation-errors branch May 23, 2022 14:11
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 74.993% when pulling 6d5fcc2 on Desuuuu:operation-errors into 2526f68 on 99designs:master.

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.

None yet

3 participants