Skip to content

Commit

Permalink
Review feedback plus clarification of error definition and should/must
Browse files Browse the repository at this point in the history
  • Loading branch information
leebyron committed Jun 22, 2022
1 parent eee64e9 commit 054e024
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
5 changes: 2 additions & 3 deletions spec/Section 6 -- Execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -776,9 +776,8 @@ A _field error_ is an error raised from a particular field during value
resolution or coercion. While these errors should be reported in the response,
they are "handled" by producing a partial response.

Note: This is distinct from a _request error_ which is raised before execution
begins. If a request error is encountered, execution does not begin and no data
is returned in the response.
Note: This is distinct from a _request error_ which results in a response with
no data.

If a field error is raised while resolving a field, it is handled as though the
field returned {null}, and the error must be added to the {"errors"} list in the
Expand Down
42 changes: 22 additions & 20 deletions spec/Section 7 -- Response.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,45 +50,47 @@ If an error was raised during the execution that prevented a valid response, the

### Errors

The `errors` entry in the response is a non-empty list of errors, where each
error is a map.
The `errors` entry in the response is a non-empty list of errors raised during
the _request_, where each error is a map of data described by the error result
format below.

If no errors were raised during the request, the `errors` entry should not be
If present, the `errors` entry in the response must contain at least one error.
If no errors were raised during the request, the `errors` entry must not be
present in the result.

If the `data` entry in the response is not present, the `errors` entry in the
response must not be empty. It must contain at least one error. The errors it
contains should indicate why no data was able to be returned.
If the `data` entry in the response is not present, the `errors` entry must be
present. It should contain at least one _request error_ indicating why no data
was able to be returned.

If the `data` entry in the response is present (including if it is the value
{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.
{null}), the `errors` entry must also be present if a _field error_ was raised
during execution.

**Request errors**

:: 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.
:: A _request error_ is an error raised during a _request_ which results in no
response data. Typically raised before execution begins, a request error 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.

A request error is typically the fault of the requesting client.

If a request error is raised, execution does not begin and the `data` entry in
the response must not be present. The `errors` entry must include the error.
If a request error is raised, the `data` entry in the response must not be
present. If a request error is encountered before execution, execution should
not begin. The `errors` entry must include the error.

**Field errors**

:: A _field error_ is raised during the execution of a particular field. This
may occur due to an internal error during value resolution or failure to coerce
the resulting value.
:: A _field error_ is an error raised during the execution of a particular field
which results in partial response data. This may occur due to an internal error
during value resolution or failure to coerce the resulting value.

A field error is typically the fault of a GraphQL service.

If a field error is raised, execution attempts to continue and a partial result
is produced (see [Handling Field Errors](#sec-Handling-Field-Errors)). The
`data` entry in the response must be present. The `errors` entry should be a
list of all raised field errors.
`data` entry in the response must be present. The `errors` entry should include
this error.

**Error result format**

Expand Down

0 comments on commit 054e024

Please sign in to comment.