Skip to content

Commit de3b487

Browse files
committed
asyncIterable: locate async iterator errors to the collection (#3899)
Currently, they are presented as errors in the next pending item. Of course, there may or not be a next pending item; there may not be a way to definitively know the reason for the error, such that the error is a function of a problem with the collection itself. As discussed in a prior incremental delivery WG meeting, this must be changed for both the non-streaming and streaming cases; this PR makes the minor adjustments addressing both cases.
1 parent d9a312d commit de3b487

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

src/execution/__tests__/lists-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ describe('Execute: Accepts async iterables as list value', () => {
141141
}
142142

143143
expectJSON(await complete({ listField })).toDeepEqual({
144-
data: { listField: ['two', '4', null] },
144+
data: { listField: null },
145145
errors: [
146146
{
147147
message: 'bad',
148148
locations: [{ line: 1, column: 3 }],
149-
path: ['listField', 2],
149+
path: ['listField'],
150150
},
151151
],
152152
});

src/execution/execute.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,9 +818,7 @@ async function completeAsyncIteratorValue(
818818
break;
819819
}
820820
} catch (rawError) {
821-
handleFieldError(rawError, exeContext, itemType, fieldGroup, itemPath);
822-
completedResults.push(null);
823-
break;
821+
throw locatedError(rawError, fieldGroup, pathToArray(path));
824822
}
825823

826824
if (

0 commit comments

Comments
 (0)