Skip to content

Commit 02d4676

Browse files
yaacovCRrobrichard
authored andcommitted
Add error handling for stream iterators (#5)
* Add error handling for stream iterators * also add iterator error handling within CompleteValue * incorporate feedback
1 parent b54c9fe commit 02d4676

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

spec/Section 6 -- Execution.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -951,25 +951,29 @@ streamRecord, variableValues, subsequentPayloads):
951951
- Set {isCompletedIterator} to {true} on {streamRecord}.
952952
- Return {null}.
953953
- Let {payload} be an unordered map.
954-
- Let {item} be the item retrieved from {iterator}.
955-
- Let {data} be the result of calling {CompleteValue(innerType, fields, item,
956-
variableValues, itemPath, subsequentPayloads, parentRecord)}.
957-
- Append any encountered field errors to {errors}.
958-
- Increment {index}.
959-
- Call {ExecuteStreamField(label, iterator, index, fields, innerType, path,
960-
streamRecord, variableValues, subsequentPayloads)}.
961-
- If {parentRecord} is defined:
962-
- Wait for the result of {dataExecution} on {parentRecord}.
963-
- If {errors} is not empty:
964-
- Add an entry to {payload} named `errors` with the value {errors}.
965-
- If a field error was raised, causing a {null} to be propagated to {data},
966-
and {innerType} is a Non-Nullable type:
954+
- If an item is not retrieved because of an error:
955+
- Append the encountered error to {errors}.
967956
- Add an entry to {payload} named `items` with the value {null}.
968957
- Otherwise:
969-
- Add an entry to {payload} named `items` with a list containing the value
970-
{data}.
958+
- Let {item} be the item retrieved from {iterator}.
959+
- Let {data} be the result of calling {CompleteValue(innerType, fields,
960+
item, variableValues, itemPath, subsequentPayloads, parentRecord)}.
961+
- Append any encountered field errors to {errors}.
962+
- Increment {index}.
963+
- Call {ExecuteStreamField(label, iterator, index, fields, innerType, path,
964+
streamRecord, variableValues, subsequentPayloads)}.
965+
- If a field error was raised, causing a {null} to be propagated to {data},
966+
and {innerType} is a Non-Nullable type:
967+
- Add an entry to {payload} named `items` with the value {null}.
968+
- Otherwise:
969+
- Add an entry to {payload} named `items` with a list containing the value
970+
{data}.
971+
- If {errors} is not empty:
972+
- Add an entry to {payload} named `errors` with the value {errors}.
971973
- Add an entry to {payload} named `label` with the value {label}.
972974
- Add an entry to {payload} named `path` with the value {itemPath}.
975+
- If {parentRecord} is defined:
976+
- Wait for the result of {dataExecution} on {parentRecord}.
973977
- Return {payload}.
974978
- Set {dataExecution} on {streamRecord}.
975979
- Append {streamRecord} to {subsequentPayloads}.
@@ -1009,7 +1013,8 @@ subsequentPayloads, asyncRecord):
10091013
path, asyncRecord, subsequentPayloads)}.
10101014
- Return {items}.
10111015
- Otherwise:
1012-
- Retrieve the next item from {result} via the {iterator}.
1016+
- Wait for the next item from {result} via the {iterator}.
1017+
- If an item is not retrieved because of an error, raise a _field error_.
10131018
- Let {resultItem} be the item retrieved from {result}.
10141019
- Let {itemPath} be {path} with {index} appended.
10151020
- Let {resolvedItem} be the result of calling {CompleteValue(innerType,

0 commit comments

Comments
 (0)