Skip to content

Commit b6b74c2

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

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

spec/Section 7 -- Response.md

+21-20
Original file line numberDiff line numberDiff line change
@@ -50,45 +50,46 @@ 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. The `errors` entry must include the error.
7980

8081
**Field errors**
8182

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.
83+
:: A _field error_ is an error raised during the execution of a particular field
84+
which results in partial response data. This may occur due to an internal error
85+
during value resolution or failure to coerce the resulting value.
8586

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

8889
If a field error is raised, execution attempts to continue and a partial result
8990
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.
91+
`data` entry in the response must be present. The `errors` entry should include
92+
this error.
9293

9394
**Error result format**
9495

0 commit comments

Comments
 (0)