@@ -137,7 +137,7 @@ ExecuteQuery(query, schema, variableValues, initialValue):
137137- Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
138138 queryType, initialValue, variableValues)} _ normally_ (allowing
139139 parallelization).
140- - Let {errors} be the list of all _ field error_ raised while executing the
140+ - Let {errors} be the list of all _ execution error_ raised while executing the
141141 selection set.
142142- Return an unordered map containing {data} and {errors}.
143143
@@ -158,7 +158,7 @@ ExecuteMutation(mutation, schema, variableValues, initialValue):
158158- Let {selectionSet} be the top level selection set in {mutation}.
159159- Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
160160 mutationType, initialValue, variableValues)} _ serially_ .
161- - Let {errors} be the list of all _ field error_ raised while executing the
161+ - Let {errors} be the list of all _ execution error_ raised while executing the
162162 selection set.
163163- Return an unordered map containing {data} and {errors}.
164164
@@ -317,10 +317,10 @@ MapSourceToResponseEvent(sourceStream, subscription, schema, variableValues):
317317 - Complete {responseStream} normally.
318318- Return {responseStream}.
319319
320- Note: Since {ExecuteSubscriptionEvent()} handles all _ field error_ , and _ request
321- error_ only occur during {CreateSourceEventStream()}, the only remaining error
322- condition handled from {ExecuteSubscriptionEvent()} are internal exceptional
323- errors not described by this specification.
320+ Note: Since {ExecuteSubscriptionEvent()} handles all _ execution error_ , and
321+ _ request error_ only occur during {CreateSourceEventStream()}, the only
322+ remaining error condition handled from {ExecuteSubscriptionEvent()} are internal
323+ exceptional errors not described by this specification.
324324
325325ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
326326
@@ -330,7 +330,7 @@ ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
330330- Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
331331 subscriptionType, initialValue, variableValues)} _ normally_ (allowing
332332 parallelization).
333- - Let {errors} be the list of all _ field error_ raised while executing the
333+ - Let {errors} be the list of all _ execution error_ raised while executing the
334334 selection set.
335335- Return an unordered map containing {data} and {errors}.
336336
@@ -376,17 +376,23 @@ ExecuteSelectionSet(selectionSet, objectType, objectValue, variableValues):
376376Note: {resultMap} is ordered by which fields appear first in the operation. This
377377is explained in greater detail in the Field Collection section below.
378378
379- ** Errors and Non-Null Fields **
379+ ** Errors and Non-Null Types **
380380
381- If during {ExecuteSelectionSet()} a field with a non-null {fieldType} raises a
382- _ field error _ then that error must propagate to this entire selection set,
383- either resolving to {null} if allowed or further propagated to a parent field.
381+ < a name = " sec-Executing-Selection-Sets.Errors-and-Non-Null-Fields " >
382+ <!-- Legacy link, this section was previously titled "Errors and Non-Null Fields" -->
383+ </ a >
384384
385- If this occurs, any sibling fields which have not yet executed or have not yet
386- yielded a value may be cancelled to avoid unnecessary work.
385+ If during {ExecuteSelectionSet()} a _ response position_ with a non-null type
386+ raises an _ execution error_ then that error must propagate to the parent
387+ response position (the entire selection set in the case of a field, or the
388+ entire list in the case of a list position), either resolving to {null} if
389+ allowed or being further propagated to a parent response position.
387390
388- Note: See [ Handling Field Errors] ( #sec-Handling-Field-Errors ) for more about
389- this behavior.
391+ If this occurs, any sibling response positions which have not yet executed or
392+ have not yet yielded a value may be cancelled to avoid unnecessary work.
393+
394+ Note: See [ Handling Execution Errors] ( #sec-Handling-Execution-Errors ) for more
395+ about this behavior.
390396
391397### Normal and Serial Execution
392398
@@ -646,7 +652,7 @@ CoerceArgumentValues(objectType, field, variableValues):
646652 - Add an entry to {coercedValues} named {argumentName} with the value
647653 {defaultValue}.
648654 - Otherwise if {argumentType} is a Non-Nullable type, and either {hasValue} is
649- not {true} or {value} is {null}, raise a _ field error_ .
655+ not {true} or {value} is {null}, raise an _ execution error_ .
650656 - Otherwise if {hasValue} is {true}:
651657 - If {value} is {null}:
652658 - Add an entry to {coercedValues} named {argumentName} with the value
@@ -656,13 +662,16 @@ CoerceArgumentValues(objectType, field, variableValues):
656662 {value}.
657663 - Otherwise:
658664 - If {value} cannot be coerced according to the input coercion rules of
659- {argumentType}, raise a _ field error_ .
665+ {argumentType}, raise an _ execution error_ .
660666 - Let {coercedValue} be the result of coercing {value} according to the
661667 input coercion rules of {argumentType}.
662668 - Add an entry to {coercedValues} named {argumentName} with the value
663669 {coercedValue}.
664670- Return {coercedValues}.
665671
672+ Any _ request error_ raised as a result of input coercion during
673+ {CoerceArgumentValues()} should be treated instead as an _ execution error_ .
674+
666675Note: Variable values are not coerced because they are expected to be coerced
667676before executing the operation in {CoerceVariableValues()}, and valid operations
668677must only allow usage of variables of appropriate types.
@@ -703,12 +712,12 @@ CompleteValue(fieldType, fields, result, variableValues):
703712 - Let {innerType} be the inner type of {fieldType}.
704713 - Let {completedResult} be the result of calling {CompleteValue(innerType,
705714 fields, result, variableValues)}.
706- - If {completedResult} is {null}, raise a _ field error_ .
715+ - If {completedResult} is {null}, raise an _ execution error_ .
707716 - Return {completedResult}.
708717- If {result} is {null} (or another internal value similar to {null} such as
709718 {undefined}), return {null}.
710719- If {fieldType} is a List type:
711- - If {result} is not a collection of values, raise a _ field error_ .
720+ - If {result} is not a collection of values, raise an _ execution error_ .
712721 - Let {innerType} be the inner type of {fieldType}.
713722 - Return a list where each list item is the result of calling
714723 {CompleteValue(innerType, fields, resultItem, variableValues)}, where
@@ -743,7 +752,7 @@ CoerceResult(leafType, value):
743752- Return the result of calling the internal method provided by the type system
744753 for determining the "result coercion" of {leafType} given the value {value}.
745754 This internal method must return a valid value for the type and not {null}.
746- Otherwise raise a _ field error_ .
755+ Otherwise raise an _ execution error_ .
747756
748757Note: If a field resolver returns {null} then it is handled within
749758{CompleteValue()} before {CoerceResult()} is called. Therefore both the input
@@ -798,39 +807,46 @@ MergeSelectionSets(fields):
798807 - Append all selections in {fieldSelectionSet} to {selectionSet}.
799808- Return {selectionSet}.
800809
801- ### Handling Field Errors
810+ ### Handling Execution Errors
811+
812+ <a name =" sec-Handling-Field-Errors " >
813+ <!-- Legacy link, this section was previously titled "Handling Execution Errors" -->
814+ </a >
802815
803- A _ field error_ is an error raised from a particular field during value
804- resolution or coercion. While these errors should be reported in the response,
805- 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 must be
818+ reported in the response, they are "handled" by producing partial {"data"} in
819+ the _ response_ .
806820
807821Note: This is distinct from a _ request error_ which results in a response with
808822no data.
809823
810- If a field error is raised while resolving a field, it is handled as though the
811- field returned {null}, and the error must be added to the {"errors"} list in the
812- response.
813-
814- If the result of resolving a field is {null} (either because the function to
815- resolve the field returned {null} or because a field error was raised), and that
816- field is of a ` Non-Null ` type, then a field error is raised. The error must be
817- added to the {"errors"} list in the response.
818-
819- If the field returns {null} because of a field error which has already been
820- added to the {"errors"} list in the response, the {"errors"} list must not be
821- further affected. That is, only one error should be added to the errors list per
822- field.
823-
824- Since ` Non-Null ` type fields cannot be {null}, field errors are propagated to be
825- handled by the parent field. If the parent field may be {null} then it resolves
826- to {null}, otherwise if it is a ` Non-Null ` type, the field error is further
827- propagated to its parent field.
828-
829- If a ` List ` type wraps a ` Non-Null ` type, and one of the elements of that list
830- resolves to {null}, then the entire list must resolve to {null}. If the ` List `
831- type is also wrapped in a ` Non-Null ` , the field error continues to propagate
832- upwards.
833-
834- If all fields from the root of the request to the source of the field error
835- return ` Non-Null ` types, then the {"data"} entry in the response should be
836- {null}.
824+ If an execution error is raised while resolving a field (either directly or
825+ nested inside any lists), it is handled as though the _ response position_ at
826+ which the error occurred resolved to {null}, and the error must be added to the
827+ {"errors"} list in the response.
828+
829+ If the result of resolving a _ response position_ is {null} (either due to the
830+ result of {ResolveFieldValue()} or because an execution error was raised), and
831+ that position is of a ` Non-Null ` type, then an execution error is raised at that
832+ position. The error must be added to the {"errors"} list in the response.
833+
834+ If a _ response position_ resolves to {null} because of an execution error which
835+ has already been added to the {"errors"} list in the response, the {"errors"}
836+ list must not be further affected. That is, only one error should be added to
837+ the errors list per _ response position_ .
838+
839+ Since ` Non-Null ` response positions cannot be {null}, execution errors are
840+ propagated to be handled by the parent _ response position_ . If the parent
841+ response position may be {null} then it resolves to {null}, otherwise if it is a
842+ ` Non-Null ` type, the execution error is further propagated to its parent
843+ _ response position_ .
844+
845+ If a ` List ` type wraps a ` Non-Null ` type, and one of the _ response position_
846+ elements of that list resolves to {null}, then the entire list _ response
847+ position_ must resolve to {null}. If the ` List ` type is also wrapped in a
848+ ` Non-Null ` , the execution error continues to propagate upwards.
849+
850+ If every _ response position_ from the root of the request to the source of the
851+ execution error has a ` Non-Null ` type, then the {"data"} entry in the response
852+ should be {null}.
0 commit comments