Skip to content

Commit f831eb7

Browse files
committed
lift up + other feedback
1 parent 05737c8 commit f831eb7

File tree

2 files changed

+68
-40
lines changed

2 files changed

+68
-40
lines changed

spec/Section 6 -- Execution.md

+25-25
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,12 @@ ExecuteSelectionSet(selectionSet, objectType, objectValue, variableValues):
376376
Note: {resultMap} is ordered by which fields appear first in the operation. This
377377
is explained in greater detail in the Field Collection section below.
378378

379+
**Errors and Non-Null Types**
380+
379381
<a name="sec-Executing-Selection-Sets.Errors-and-Non-Null-Fields">
380-
<!-- This link exists for legacy hyperlink support -->
382+
<!-- Legacy link, this section was previously titled "Errors and Non-Null Fields" -->
381383
</a>
382384

383-
**Errors and Non-Null Types**
384-
385385
If during {ExecuteSelectionSet()} a _response position_ with a non-null type
386386
raises an _execution error_ then that error must propagate to the parent
387387
response position (the entire selection set in the case of a field, or the
@@ -626,9 +626,6 @@ the type system to have a specific input type.
626626
At each argument position in an operation may be a literal {Value}, or a
627627
{Variable} to be provided at runtime.
628628

629-
Any _request error_ raised during {CoerceArgumentValues()} should be treated
630-
instead as an _execution error_.
631-
632629
CoerceArgumentValues(objectType, field, variableValues):
633630

634631
- Let {coercedValues} be an empty unordered Map.
@@ -672,6 +669,9 @@ CoerceArgumentValues(objectType, field, variableValues):
672669
{coercedValue}.
673670
- Return {coercedValues}.
674671

672+
Any _request error_ raised as a result of input coercion during
673+
{CoerceArgumentValues()} should be treated instead as an _execution error_.
674+
675675
Note: Variable values are not coerced because they are expected to be coerced
676676
before executing the operation in {CoerceVariableValues()}, and valid operations
677677
must only allow usage of variables of appropriate types.
@@ -807,45 +807,45 @@ MergeSelectionSets(fields):
807807
- Append all selections in {fieldSelectionSet} to {selectionSet}.
808808
- Return {selectionSet}.
809809

810+
### Handling Execution Errors
811+
810812
<a name="sec-Handling-Field-Errors">
811-
<!-- This link exists for legacy hyperlink support -->
813+
<!-- Legacy link, this section was previously titled "Handling Execution Errors" -->
812814
</a>
813815

814-
### Handling Execution Errors
815-
816-
An _execution error_ is an error raised from a particular field during value
817-
resolution or coercion. While these errors should be reported in the response,
818-
they are "handled" by producing a partial response.
816+
An _execution error_ is an error raised during field execution, value resolution
817+
or coercion, at a specific _response position_. While these errors should be
818+
reported in the response, they are "handled" by producing a partial response.
819819

820820
Note: This is distinct from a _request error_ which results in a response with
821821
no data.
822822

823823
If an execution error is raised while resolving a field (either directly or
824-
nested inside any lists), it is handled as though the position at which the
825-
error occurred resulted in {null}, and the error must be added to the {"errors"}
826-
list in the response.
824+
nested inside any lists), it is handled as though the _response position_ at
825+
which the error occurred resolved to {null}, and the error must be added to the
826+
{"errors"} list in the response.
827827

828828
If the result of resolving a _response position_ is {null} (either due to the
829829
result of {ResolveFieldValue()} or because an execution error was raised), and
830830
that position is of a `Non-Null` type, then an execution error is raised at that
831831
position. The error must be added to the {"errors"} list in the response.
832832

833-
If a _response position_ returns {null} because of an execution error which has
834-
already been added to the {"errors"} list in the response, the {"errors"} list
835-
must not be further affected. That is, only one error should be added to the
836-
errors list per _response position_.
833+
If a _response position_ resolves to {null} because of an execution error which
834+
has already been added to the {"errors"} list in the response, the {"errors"}
835+
list must not be further affected. That is, only one error should be added to
836+
the errors list per _response position_.
837837

838838
Since `Non-Null` response positions cannot be {null}, execution errors are
839839
propagated to be handled by the parent _response position_. If the parent
840840
response position may be {null} then it resolves to {null}, otherwise if it is a
841841
`Non-Null` type, the execution error is further propagated to its parent
842842
_response position_.
843843

844-
If a `List` type wraps a `Non-Null` type, and one of the elements of that list
845-
resolves to {null}, then the entire list must resolve to {null}. If the `List`
846-
type is also wrapped in a `Non-Null`, the execution error continues to propagate
847-
upwards.
844+
If a `List` type wraps a `Non-Null` type, and one of the _response position_
845+
elements of that list resolves to {null}, then the entire list _response
846+
position_ must resolve to {null}. If the `List` type is also wrapped in a
847+
`Non-Null`, the execution error continues to propagate upwards.
848848

849849
If every _response position_ from the root of the request to the source of the
850-
execution error returns a `Non-Null` type, then the {"data"} entry in the
851-
response should be {null}.
850+
execution error has a `Non-Null` type, then the {"data"} entry in the response
851+
should be {null}.

spec/Section 7 -- Response.md

+43-15
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,36 @@ present in the response.
5757
If an error was raised during the execution that prevented a valid response, the
5858
`data` entry in the response should be `null`.
5959

60+
**Response Position**
61+
62+
:: A _response position_ is a uniquely identifiable position in the response
63+
data produced during execution. It is either a direct entry in the {resultMap}
64+
of a {ExecuteSelectionSet()}, or it is a position in a (potentially nested) List
65+
value.
66+
67+
The response data is the result of accumulating the result of all response
68+
positions during execution.
69+
70+
Each _response position_ is uniquely identifiable via a _path entry_.
71+
72+
A single field execution may result in multiple response positions. For example,
73+
74+
```graphql example
75+
{
76+
hero(episode: $episode) {
77+
name
78+
friends {
79+
name
80+
}
81+
}
82+
}
83+
```
84+
85+
The hero's name would be found in the _response position_ identified by
86+
`["hero", "name"]`. The List of the hero's friends would be found at
87+
`["hero", "friends"]`, the hero's first friend at `["hero", "friends", 0]` and
88+
that friend's name at `["hero", "friends", 0, "name"]`.
89+
6090
### Errors
6191

6292
The `errors` entry in the response is a non-empty list of errors raised during
@@ -88,33 +118,31 @@ If a request error is raised, the `data` entry in the response must not be
88118
present, the `errors` entry must include the error, and request execution should
89119
be halted.
90120

121+
**Execution Errors**
122+
91123
<a name="sec-Errors.Field-Errors">
92-
<!-- This link exists for legacy hyperlink support -->
124+
<!-- Legacy link, this section was previously titled "Field Errors" -->
93125
</a>
94126

95-
**Execution Errors**
96-
97127
:: An _execution error_ is an error raised during the execution of a particular
98128
field which results in partial response data. This may occur due to failure to
99129
coerce the arguments for the field, an internal error during value resolution,
100-
or failure to coerce the resulting value. An _execution error_ may occur in any
101-
_response position_.
130+
or failure to coerce the resulting value.
102131

103132
Note: In previous versions of this specification _execution error_ was called
104133
_field error_.
105134

106-
:: A _response position_ is an identifiable position in the response: either a
107-
_field_, or a (potentially nested) list position within a field if the field has
108-
a `List` type. An _execution error_ may only occur within a _response position_.
109-
The _response position_ is indicated in the _response_ via the error's _path
110-
entry_.
111-
112135
An execution error is typically the fault of a GraphQL service.
113136

114-
If an execution error is raised, execution attempts to continue and a partial
115-
result is produced (see
116-
[Handling Execution Errors](#sec-Handling-Execution-Errors)). The `data` entry
117-
in the response must be present. The `errors` entry must include this error.
137+
An _execution error_ must occur at a specific _response position_, and may occur
138+
in any response position. The response position of an execution error is
139+
indicated via the error's `path` _path entry_.
140+
141+
When an execution error is raised at a given _response position_, then that
142+
response position must not be present within the _response_ `data` entry (except
143+
{null}), and the `errors` entry must include the error. Nested execution is
144+
halted and sibling execution attempts to continue, producing partial result (see
145+
[Handling Execution Errors](#sec-Handling-Execution-Errors)).
118146

119147
**Error Result Format**
120148

0 commit comments

Comments
 (0)