Skip to content

Commit bc9c522

Browse files
robrichardyaacovCR
authored andcommitted
Clarify error handling
# Conflicts: # spec/Section 6 -- Execution.md
1 parent 625ff5d commit bc9c522

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

spec/Section 6 -- Execution.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,9 @@ YieldSubsequentPayloads(subsequentPayloads):
393393
- Return.
394394
- If {subsequentPayloads} is not empty:
395395
- Continue to the next record in {subsequentPayloads}.
396-
- If {record} is not the final element in {subsequentPayloads}
396+
- If {record} is not the final element in {subsequentPayloads}:
397397
- Add an entry to {payload} named `hasNext` with the value {true}.
398-
- If {record} is the final element in {subsequentPayloads}
398+
- If {record} is the final element in {subsequentPayloads}:
399399
- Add an entry to {payload} named `hasNext` with the value {false}.
400400
- Yield {payload}
401401

@@ -693,11 +693,16 @@ path, variableValues, parentRecord, subsequentPayloads):
693693
- Let {deferRecord} be an async payload record created from {label} and {path}.
694694
- Initialize {errors} on {deferRecord} to an empty list.
695695
- Let {dataExecution} be the asynchronous future value of:
696-
- Let {payload} be the result of {ExecuteSelectionSet(fragmentSelectionSet,
696+
- Let {payload} be an unordered map.
697+
- Let {data} be the result of {ExecuteSelectionSet(fragmentSelectionSet,
697698
objectType, objectValue, variableValues, path, subsequentPayloads,
698699
deferRecord)}.
700+
- Append any encountered field errors to {errors}.
699701
- If {parentRecord} is defined:
700702
- Wait for the result of {dataExecution} on {parentRecord}.
703+
- If {errors} is not empty:
704+
- Add an entry to {payload} named `errors` with the value {errors}.
705+
- Add an entry to {payload} named `data` with the value {data}.
701706
- Add an entry to {payload} named `label` with the value {label}.
702707
- Add an entry to {payload} named `path` with the value {path}.
703708
- Return {payload}.
@@ -848,8 +853,8 @@ directive.
848853

849854
#### Execute Stream Field
850855

851-
ExecuteStreamRecord(label, iterator, index, fields, innerType, path
852-
streamRecord, variableValues, subsequentPayloads):
856+
ExecuteStreamField(label, iterator, index, fields, innerType, path streamRecord,
857+
variableValues, subsequentPayloads):
853858

854859
- Let {streamRecord} be an async payload record created from {label}, {path},
855860
and {iterator}.
@@ -859,14 +864,19 @@ streamRecord, variableValues, subsequentPayloads):
859864
- Wait for the next item from {iterator}.
860865
- If an item is not retrieved because {iterator} has completed:
861866
- Return {null}.
867+
- Let {payload} be an unordered map.
862868
- Let {item} be the item retrieved from {iterator}.
863-
- Let {payload} be the result of calling {CompleteValue(innerType, fields,
864-
item, variableValues, indexPath, subsequentPayloads, parentRecord)}.
869+
- Let {data} be the result of calling {CompleteValue(innerType, fields, item,
870+
variableValues, indexPath, subsequentPayloads, parentRecord)}.
871+
- Append any encountered field errors to {errors}.
865872
- Increment {index}.
866-
- Call {ExecuteStreamRecord(label, iterator, index, fields, innerType, path,
873+
- Call {ExecuteStreamField(label, iterator, index, fields, innerType, path,
867874
streamRecord, variableValues, subsequentPayloads)}.
868875
- If {parentRecord} is defined:
869876
- Wait for the result of {dataExecution} on {parentRecord}.
877+
- If {errors} is not empty:
878+
- Add an entry to {payload} named `errors` with the value {errors}.
879+
- Add an entry to {payload} named `data` with the value {data}.
870880
- Add an entry to {payload} named `label` with the value {label}.
871881
- Add an entry to {payload} named `path` with the value {indexPath}.
872882
- Return {payload}.
@@ -909,7 +919,7 @@ subsequentPayloads, asyncRecord):
909919
- Increment {index}.
910920
- If {streamDirective} was provided and {index} is greater than or equal
911921
to {initialCount}:
912-
- Call {ExecuteStreamRecord(label, result, index, fields, innerType,
922+
- Call {ExecuteStreamField(label, result, index, fields, innerType,
913923
path, asyncRecord, subsequentPayloads)}.
914924
- Let {result} be {initialItems}.
915925
- Exit while loop.

0 commit comments

Comments
 (0)