Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error handling for stream iterators #5

Merged
merged 3 commits into from
Nov 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions spec/Section 6 -- Execution.md
Original file line number Diff line number Diff line change
Expand Up @@ -951,25 +951,29 @@ streamRecord, variableValues, subsequentPayloads):
- Set {isCompletedIterator} to {true} on {streamRecord}.
- Return {null}.
- Let {payload} be an unordered map.
- Let {item} be the item retrieved from {iterator}.
- Let {data} be the result of calling {CompleteValue(innerType, fields, item,
variableValues, itemPath, subsequentPayloads, parentRecord)}.
- Append any encountered field errors to {errors}.
- Increment {index}.
- Call {ExecuteStreamField(label, iterator, index, fields, innerType, path,
streamRecord, variableValues, subsequentPayloads)}.
- If {parentRecord} is defined:
- Wait for the result of {dataExecution} on {parentRecord}.
- If {errors} is not empty:
- Add an entry to {payload} named `errors` with the value {errors}.
- If a field error was raised, causing a {null} to be propagated to {data},
and {innerType} is a Non-Nullable type:
- If an item is not retrieved because of an error:
- Append the encountered error to {errors}.
- Add an entry to {payload} named `items` with the value {null}.
- Otherwise:
- Add an entry to {payload} named `items` with a list containing the value
{data}.
- Let {item} be the item retrieved from {iterator}.
- Let {data} be the result of calling {CompleteValue(innerType, fields,
item, variableValues, itemPath, subsequentPayloads, parentRecord)}.
- Append any encountered field errors to {errors}.
- Increment {index}.
- Call {ExecuteStreamField(label, iterator, index, fields, innerType, path,
streamRecord, variableValues, subsequentPayloads)}.
- If a field error was raised, causing a {null} to be propagated to {data},
and {innerType} is a Non-Nullable type:
- Add an entry to {payload} named `items` with the value {null}.
- Otherwise:
- Add an entry to {payload} named `items` with a list containing the value
{data}.
- If {errors} is not empty:
- Add an entry to {payload} named `errors` with the value {errors}.
- Add an entry to {payload} named `label` with the value {label}.
- Add an entry to {payload} named `path` with the value {itemPath}.
- If {parentRecord} is defined:
- Wait for the result of {dataExecution} on {parentRecord}.
- Return {payload}.
- Set {dataExecution} on {streamRecord}.
- Append {streamRecord} to {subsequentPayloads}.
Expand Down Expand Up @@ -1009,7 +1013,8 @@ subsequentPayloads, asyncRecord):
path, asyncRecord, subsequentPayloads)}.
- Return {items}.
- Otherwise:
- Retrieve the next item from {result} via the {iterator}.
- Wait for the next item from {result} via the {iterator}.
- If an item is not retrieved because of an error, raise a _field error_.
- Let {resultItem} be the item retrieved from {result}.
- Let {itemPath} be {path} with {index} appended.
- Let {resolvedItem} be the result of calling {CompleteValue(innerType,
Expand Down