Skip to content

Commit c44a7ae

Browse files
committed
Clarify the interaction of onError:HALT and subscriptions
1 parent 6fd7239 commit c44a7ae

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

spec/Section 6 -- Execution.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -615,18 +615,22 @@ raises an _execution error_, the error must be added to the {"errors"} list in
615615
the _execution result_ and then handled according to the _error behavior_ of the
616616
request:
617617

618-
- {"NULL"}: The _response position_ must be set to {null}. (The client is
619-
responsible for interpreting this {null} in conjunction with the {"errors"}
620-
list to distinguish error results from intentional {null} values.)
618+
- {"NULL"}: The _response position_ must be set to {null}, even if such position
619+
is indicated by the schema to be non-nullable. (The client is responsible for
620+
interpreting this {null} in conjunction with the {"errors"} list to
621+
distinguish error results from intentional {null} values.)
621622
- {"PROPAGATE"}: The _execution error_ must propagate to the parent _response
622623
position_ (the entire selection set in the case of a field, or the entire list
623624
in the case of a list position). The parent position resolves to {null} if
624625
allowed, or else the error is further propagated to a parent response
625626
position. Any sibling response positions that have not yet executed or have
626627
not yet yielded a value may be cancelled to avoid unnecessary work.
627-
- {"HALT"}: The entire _request_ must be cancelled. The {"data"} entry in the
628-
_response_ must be {null}. Any _response position_ that has not yet executed
629-
or has not yet yielded a value may be cancelled to avoid unnecessary work.
628+
- {"HALT"}: The current {ExecuteRootSelectionSet()} must be aborted immediately
629+
and must yield an execution result with an {"errors"} list consisting of this
630+
_execution error_ only and the {"data"} entry set to {null}. Any _response
631+
position_ that has not yet executed or has not yet yielded a value may be
632+
cancelled to avoid unnecessary work. (Note: For a subscription operation the
633+
underlying stream is not terminated.)
630634

631635
Note: See [Handling Execution Errors](#sec-Handling-Execution-Errors) for more
632636
about this behavior.
@@ -943,7 +947,7 @@ Valid values for _error behavior_ are {"NULL"}, {"PROPAGATE"} and {"HALT"}.
943947
compatibility with existing clients, services should default to {"PROPAGATE"}
944948
which reflects prior behavior. <!-- For new services, {"NULL"} is
945949
recommended. --> The default error behavior is indicated via the {"org.graphql.defaultErrorBehavior"}
946-
_capability_.
950+
_service capability_.
947951

948952
Note: {"HALT"} is not recommended as the _default error behavior_ because it
949953
prevents generating partial responses which may still contain useful data.
@@ -993,6 +997,10 @@ result_ should be {null}.
993997

994998
**{"HALT"}**
995999

996-
With {"HALT"}, execution must cease immediately when the first _execution error_
997-
is raised. That error must be added to the {"errors"} list, and {"data"} must be
998-
{null}.
1000+
With {"HALT"}, {ExecuteRootSelectionSet()} must cease immediately that the first
1001+
_execution error_ is raised. That error must be added to the {"errors"} list,
1002+
and {"data"} must be {null}.
1003+
1004+
Note: For subscription operations, processing of the current event is ceased,
1005+
but the subscription still remains in place and future events will be processed
1006+
as normal.

0 commit comments

Comments
 (0)