@@ -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 _ runtime 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 _ runtime 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 _ runtime 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 _ runtime error_ raised while executing the
334334 selection set.
335335- Return an unordered map containing {data} and {errors}.
336336
@@ -377,16 +377,22 @@ ExecuteSelectionSet(selectionSet, objectType, objectValue, variableValues):
377377Note: {resultMap} is ordered by which fields appear first in the operation. This
378378is explained in greater detail in the Field Collection section below.
379379
380- ** Errors and Non-Null Fields**
380+ <a name =" sec-Executing-Selection-Sets.Errors-and-Non-Null-Fields " >
381+ <!-- This link exists for legacy hyperlink support -->
382+ </a >
381383
382- If during {ExecuteSelectionSet()} a field with a non-null {fieldType} raises a
383- _ field error_ then that error must propagate to this entire selection set,
384- either resolving to {null} if allowed or further propagated to a parent field.
384+ ** Errors and Non-Null Types**
385385
386- If this occurs, any sibling fields which have not yet executed or have not yet
387- yielded a value may be cancelled to avoid unnecessary work.
386+ If during {ExecuteSelectionSet()} a _ response position_ with a non-null type
387+ raises a _ runtime error_ then that error must propagate to the parent response
388+ position (the entire selection set in the case of a field, or the entire list in
389+ the case of a list position), either resolving to {null} if allowed or being
390+ further propagated to a parent _ response position_ .
388391
389- Note: See [ Handling Field Errors] ( #sec-Handling-Field-Errors ) for more about
392+ If this occurs, any sibling response position which have not yet executed or
393+ have not yet yielded a value may be cancelled to avoid unnecessary work.
394+
395+ Note: See [ Handling Runtime Errors] ( #sec-Handling-Runtime-Errors ) for more about
390396this behavior.
391397
392398### Normal and Serial Execution
@@ -647,7 +653,7 @@ CoerceArgumentValues(objectType, field, variableValues):
647653 - Add an entry to {coercedValues} named {argumentName} with the value
648654 {defaultValue}.
649655 - Otherwise if {argumentType} is a Non-Nullable type, and either {hasValue} is
650- not {true} or {value} is {null}, raise a _ field error_ .
656+ not {true} or {value} is {null}, raise a _ runtime error_ .
651657 - Otherwise if {hasValue} is {true}:
652658 - If {value} is {null}:
653659 - Add an entry to {coercedValues} named {argumentName} with the value
@@ -657,7 +663,7 @@ CoerceArgumentValues(objectType, field, variableValues):
657663 {value}.
658664 - Otherwise:
659665 - If {value} cannot be coerced according to the input coercion rules of
660- {argumentType}, raise a _ field error_ .
666+ {argumentType}, raise a _ runtime error_ .
661667 - Let {coercedValue} be the result of coercing {value} according to the
662668 input coercion rules of {argumentType}.
663669 - Add an entry to {coercedValues} named {argumentName} with the value
@@ -704,12 +710,12 @@ CompleteValue(fieldType, fields, result, variableValues):
704710 - Let {innerType} be the inner type of {fieldType}.
705711 - Let {completedResult} be the result of calling {CompleteValue(innerType,
706712 fields, result, variableValues)}.
707- - If {completedResult} is {null}, raise a _ field error_ .
713+ - If {completedResult} is {null}, raise a _ runtime error_ .
708714 - Return {completedResult}.
709715- If {result} is {null} (or another internal value similar to {null} such as
710716 {undefined}), return {null}.
711717- If {fieldType} is a List type:
712- - If {result} is not a collection of values, raise a _ field error_ .
718+ - If {result} is not a collection of values, raise a _ runtime error_ .
713719 - Let {innerType} be the inner type of {fieldType}.
714720 - Return a list where each list item is the result of calling
715721 {CompleteValue(innerType, fields, resultItem, variableValues)}, where
@@ -744,7 +750,7 @@ CoerceResult(leafType, value):
744750- Return the result of calling the internal method provided by the type system
745751 for determining the "result coercion" of {leafType} given the value {value}.
746752 This internal method must return a valid value for the type and not {null}.
747- Otherwise raise a _ field error_ .
753+ Otherwise raise a _ runtime error_ .
748754
749755Note: If a field resolver returns {null} then it is handled within
750756{CompleteValue()} before {CoerceResult()} is called. Therefore both the input
@@ -799,39 +805,45 @@ MergeSelectionSets(fields):
799805 - Append all selections in {fieldSelectionSet} to {selectionSet}.
800806- Return {selectionSet}.
801807
802- ### Handling Field Errors
808+ <a name =" sec-Handling-Field-Errors " >
809+ <!-- This link exists for legacy hyperlink support -->
810+ </a >
811+
812+ ### Handling Runtime Errors
803813
804- A _ field error_ is an error raised from a particular field during value
814+ A _ runtime error_ is an error raised from a particular field during value
805815resolution or coercion. While these errors should be reported in the response,
806816they are "handled" by producing a partial response.
807817
808818Note: This is distinct from a _ request error_ which results in a response with
809819no data.
810820
811- If a field error is raised while resolving a field, it is handled as though the
812- field returned {null}, and the error must be added to the {"errors"} list in the
813- response.
821+ If a runtime error is raised while resolving a field (either directly or nested
822+ inside any lists), it is handled as though the position at which the error
823+ occurred resulted in {null}, and the error must be added to the {"errors"} list
824+ in the response.
814825
815- If the result of resolving a field is {null} (either because the function to
816- resolve the field returned {null } or because a field error was raised), and that
817- field is of a ` Non-Null ` type, then a field error is raised. The error must be
818- added to the {"errors"} list in the response.
826+ If the result of resolving a _ response position _ is {null} (either due to the
827+ result of {ResolveFieldValue() } or because a runtime error was raised), and that
828+ position is of a ` Non-Null ` type, then a runtime error is raised at that
829+ position. The error must be added to the {"errors"} list in the response.
819830
820- If the field returns {null} because of a field error which has already been
821- added to the {"errors"} list in the response, the {"errors"} list must not be
822- further affected. That is, only one error should be added to the errors list per
823- field .
831+ If a _ response position _ returns {null} because of a runtime error which has
832+ already been added to the {"errors"} list in the response, the {"errors"} list
833+ must not be further affected. That is, only one error should be added to the
834+ errors list per _ response position _ .
824835
825- Since ` Non-Null ` type fields cannot be {null}, field errors are propagated to be
826- handled by the parent field. If the parent field may be {null} then it resolves
827- to {null}, otherwise if it is a ` Non-Null ` type, the field error is further
828- propagated to its parent field.
836+ Since ` Non-Null ` response positions cannot be {null}, runtime errors are
837+ propagated to be handled by the parent _ response position_ . If the parent
838+ response position may be {null} then it resolves to {null}, otherwise if it is a
839+ ` Non-Null ` type, the runtime error is further propagated to its parent _ response
840+ position_ .
829841
830842If a ` List ` type wraps a ` Non-Null ` type, and one of the elements of that list
831843resolves to {null}, then the entire list must resolve to {null}. If the ` List `
832- type is also wrapped in a ` Non-Null ` , the field error continues to propagate
844+ type is also wrapped in a ` Non-Null ` , the runtime error continues to propagate
833845upwards.
834846
835- If all fields from the root of the request to the source of the field error
836- return ` Non-Null ` types, then the {"data"} entry in the response should be
837- {null}.
847+ If all response positions from the root of the request to the source of the
848+ runtime error return ` Non-Null ` types, then the {"data"} entry in the response
849+ should be {null}.
0 commit comments