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

Clarify types of errors in spec text #385

Merged
merged 3 commits into from
Apr 18, 2018
Merged

Conversation

IvanGoncharov
Copy link
Member

I noticed that all the errors mentioned in the specification could be divided into the following categories:

  • syntax error
  • validation error
  • query error
  • field error

I reviewed existing error mentions in the spec text and clarified their type.
In future, it would be great to add separate Errors types section to list all possible error types and describe them.

@stubailo
Copy link
Contributor

I think to start, we could just group into:

  1. Syntax
  2. Validation
  3. Execution

In your text you separate "query" from "field", but it seems like a lot of the examples are actually validation errors, right?

@leebyron
Copy link
Collaborator

I think the initial intent was for "query errors" to be errors having to do with the query itself (syntax or validation) while "field errors" were errors encountered while evaluating a field.

@leebyron
Copy link
Collaborator

Though a good clarification this PR makes is that query errors are not just syntax and validation but also variable coercion

@stubailo
Copy link
Contributor

Hmm - I'm a bit worried about further overloading the word "query" - it's already hard to tell the difference between documents, operations, query operations, etc.

@leebyron
Copy link
Collaborator

leebyron commented Nov 29, 2017

Excellent point, @stubailo - I think perhaps "document" error might be a better fit. I think at Facebook we've also called these "fatal error" since they result in no execution result (no data key in response)

In terms of clarifying the spec, I definitely agree that defining the different kinds of errors is important (and could lead to error codes proposals in the future) but what is most important in this immediate context is the behavioral differences between them. In that sense there are really 2 behaviorally different errors - those that result in no data key, and those that are local to one field in the response.

@IvanGoncharov
Copy link
Member Author

In that sense there are really 2 behaviorally different errors - those that result in no data key, and those that are local to one field in the response.

@stubailo @leebyron I think it very important to make it more explicit in the spec. For example, I was very surprised to find out that error during coercion of query variables is "fatal" error.

So I think error names should describe the expected result of errors instead of a place where they were originated.
What do you think about using partial error and fatal error?

@leebyron
Copy link
Collaborator

Merging since this is a pretty straightforward editing suggestion that's not changing anything - I still agree that the overall language around errors could be more clear

@leebyron leebyron merged commit 1d56b88 into graphql:master Apr 18, 2018
@IvanGoncharov IvanGoncharov deleted the errors branch May 15, 2018 09:33
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.

4 participants