Skip to content

Commit 054e024

Browse files
committed
Review feedback plus clarification of error definition and should/must
1 parent eee64e9 commit 054e024

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

spec/Section 6 -- Execution.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -776,9 +776,8 @@ A _field error_ is an error raised from a particular field during value
776776
resolution or coercion. While these errors should be reported in the response,
777777
they are "handled" by producing a partial response.
778778

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

783782
If a field error is raised while resolving a field, it is handled as though the
784783
field returned {null}, and the error must be added to the {"errors"} list in the

spec/Section 7 -- Response.md

+22-20
Original file line numberDiff line numberDiff line change
@@ -50,45 +50,47 @@ If an error was raised during the execution that prevented a valid response, the
5050

5151
### Errors
5252

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

56-
If no errors were raised during the request, the `errors` entry should not be
57+
If present, the `errors` entry in the response must contain at least one error.
58+
If no errors were raised during the request, the `errors` entry must not be
5759
present in the result.
5860

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

6365
If the `data` entry in the response is present (including if it is the value
64-
{null}), the `errors` entry in the response may contain a list of all _field
65-
error_ that were raised during execution. If any _field error_ was raised during
66-
execution, it should contain the `errors` entry.
66+
{null}), the `errors` entry must also be present if a _field error_ was raised
67+
during execution.
6768

6869
**Request errors**
6970

70-
:: A _request error_ is an error raised during a _request_ but before execution
71-
begins. This may occur due to a parse grammar or validation error in the
72-
_Document_, an inability to determine which operation to execute, or invalid
73-
input values for variables.
71+
:: A _request error_ is an error raised during a _request_ which results in no
72+
response data. Typically raised before execution begins, a request error may
73+
occur due to a parse grammar or validation error in the _Document_, an inability
74+
to determine which operation to execute, or invalid input values for variables.
7475

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

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

8082
**Field errors**
8183

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

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

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

9395
**Error result format**
9496

0 commit comments

Comments
 (0)