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

Editorial: Error Terminology #966

Merged
merged 4 commits into from
Jun 23, 2022
Merged

Editorial: Error Terminology #966

merged 4 commits into from
Jun 23, 2022

Conversation

leebyron
Copy link
Collaborator

@leebyron leebyron commented Jun 21, 2022

Uses the definition syntax to set definitions for "field error" and "request error", and uses italic references in every formal normative location as well as the first reference in each prose.

This also clarifies when we previously used a plural "field errors" that we actually mean "a list of field error"

Include links to other sections as set up in #957

@netlify
Copy link

netlify bot commented Jun 21, 2022

Deploy Preview for graphql-spec-draft ready!

Name Link
🔨 Latest commit 69cd302
🔍 Latest deploy log https://app.netlify.com/sites/graphql-spec-draft/deploys/62b4f62afabe2e00089a88a8
😎 Deploy Preview https://deploy-preview-966--graphql-spec-draft.netlify.app/draft
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@leebyron leebyron requested a review from benjie June 21, 2022 20:42
@leebyron leebyron force-pushed the editorial-error-terminology branch from 8323576 to f6dbee8 Compare June 21, 2022 20:45
Uses the definition syntax to set definitions for "field error" and "request error", and uses italic references in every formal normative location as well as the first reference in each prose.

This also clarifies when we previously used a plural "field errors" that we actually mean "a list of field error"

Include links to other sections as set up in #957

Co-authored-by: Roman Ivantsov <[email protected]>
Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

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

Generally great improvement, section 7 needs perhaps a little extra attention. Also, see related: #967

should contain those errors.
{null}), the `errors` entry in the response may contain a list of all _field
error_ that were raised during execution. If any _field error_ was raised during
execution, it should contain the `errors` entry.
Copy link
Member

Choose a reason for hiding this comment

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

Because we've gone from plural to singular, the "it" has become ambiguous (it could be referring to the "field error"); so let's clarify:

Suggested change
execution, it should contain the `errors` entry.
execution, the request should contain the `errors` entry.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the second sentence (If any field error was raised... it SHOULD (?) contain ...) is a repetition of the first sentence (the errors entry in the response MAY(?) contain a list...) - basically saying 'errors' contains errors raised.
At the same time, there is slight contradiction - MAY vs SHOULD

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to remove the second sentence and change MAY -> SHOULD in the first.

Copy link
Member

Choose a reason for hiding this comment

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

The may is because the errors field is not required to be present (e.g. it will not be present in the case of no errors). The should is to indicate that the field should be present if there are errors. But I agree, the existing wording could be improved; something like:

the response may include an errors property containing a list of all field error that were raised during execution.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Lots of confusing interchanging of must/should - let me try to reword this section further to clarify

:: A _request error_ is an error raised during a _request_ but before execution
begins. This may occur due to a parse grammar or validation error in the
_Document_, an inability to determine which operation to execute, or invalid
input values for variables.
Copy link
Member

Choose a reason for hiding this comment

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

Note CreateSourceEventStream() can also raise a request error:

  1. If groupedFieldSet does not have exactly one entry, raise a request error.

-- https://spec.graphql.org/draft/#CreateSourceEventStream()

There's also various places where there are Assert: that could raise an error (though if you've done validation they should not occur, except when we don't handle that well).

The phrase "before execution begins" is quite a fuzzy definition it turns out; here's a comment where I try and pick it apart a bit: graphql/graphql-js#3640 (comment)

My current opinion is that "execution begins"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Time boundary isn't the best way to describe this. Maybe prose about this being "typical" could be helpful, but really the difference is that field errors go alongside partial results where request errors do not

Copy link
Member

Choose a reason for hiding this comment

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

That's kind of circular reasoning though; for example if an error is raised from the subscribe() resolver of a field (i.e. in step 10 of CreateSourceEventStream() via the ResolveFieldEventStream() algorithm) then it's not clear from the spec whether that should be a request error (since it prevents setting up the subscription, so the request cannot continue) or a field error (since it originated from a field). And thus, it's not clear if it should resolve to {data: null, errors: [...]} or just {errors: [...]} - and thus not clear if it's a partial result or not.

In my opinion, the boundary is effectively that it's a request error if it happens before the first ExecuteSelectionSet(); the boundaries I defined above give this rule of thumb explicit positions in the algorithm that are passed once only for each request.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In my opinion, the boundary is effectively that it's a request error if it happens before the first ExecuteSelectionSet()

That does seem to be currently true. Feels too in the weeds to be the written definition.

I applied an update, curious if you find it clearer

@leebyron
Copy link
Collaborator Author

Thanks for the detailed read! I'll incorporate

@leebyron leebyron requested a review from benjie June 22, 2022 20:23
@leebyron leebyron force-pushed the editorial-error-terminology branch from b6b74c2 to 054e024 Compare June 22, 2022 20:29
@leebyron leebyron force-pushed the editorial-error-terminology branch from 054e024 to 9e70c72 Compare June 22, 2022 20:30
Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

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

Really good improvements! I have a couple minor suggestions:

Co-authored-by: Benjie Gillam <[email protected]>
@leebyron leebyron requested a review from benjie June 23, 2022 17:59
@leebyron
Copy link
Collaborator Author

Merged your suggestions @benjie

Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

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

Really good improvements, thanks @leebyron 🙌

@@ -154,7 +155,8 @@ ExecuteMutation(mutation, schema, variableValues, initialValue):
- Let {selectionSet} be the top level Selection Set in {mutation}.
- Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
mutationType, initialValue, variableValues)} _serially_.
- Let {errors} be any _field errors_ produced while executing the selection set.
- Let {errors} be the list of all _field error_ raised while executing the
Copy link
Contributor

Choose a reason for hiding this comment

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

field errors plural?

@@ -302,7 +304,8 @@ ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
- Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
subscriptionType, initialValue, variableValues)} _normally_ (allowing
parallelization).
- Let {errors} be any _field errors_ produced while executing the selection set.
- Let {errors} be the list of all _field error_ raised while executing the
Copy link
Contributor

Choose a reason for hiding this comment

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

Plural?

Copy link
Collaborator Author

@leebyron leebyron Jun 23, 2022

Choose a reason for hiding this comment

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

For this to be a glossary referenced term it need to remain in the singular, hence "list of field error" vs "field errors". It's a little grammatically awkward, but hopefully palatable

@leebyron leebyron merged commit 3885a64 into main Jun 23, 2022
@leebyron leebyron deleted the editorial-error-terminology branch June 23, 2022 23:27
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