Skip to content

Commit a67f659

Browse files
committed
asyncIterable: locate async iterator errors to the collection (graphql#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 9475dc4 commit a67f659

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

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
@@ -779,9 +779,7 @@ async function completeAsyncIteratorValue(
779779
break;
780780
}
781781
} catch (rawError) {
782-
handleFieldError(rawError, exeContext, itemType, fieldGroup, itemPath);
783-
completedResults.push(null);
784-
break;
782+
throw locatedError(rawError, fieldGroup, pathToArray(path));
785783
}
786784

787785
if (

0 commit comments

Comments
 (0)