Skip to content

Commit a0036ff

Browse files
committed
use completePromiseCatchingErrors within completeListItemValue
1 parent 4ffe3fd commit a0036ff

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/execution/__tests__/stream-test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,11 @@ describe('Execute: stream directive', () => {
531531
},
532532
],
533533
},
534+
],
535+
hasNext: true,
536+
},
537+
{
538+
incremental: [
534539
{
535540
items: [{ name: 'Leia', id: '3' }],
536541
path: ['friendList', 2],

src/execution/execute.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,29 +1191,18 @@ function completeListItemValue(
11911191
asyncPayloadRecord?: AsyncPayloadRecord,
11921192
): boolean {
11931193
if (isPromise(item)) {
1194-
const completedItem = item.then((resolved) =>
1195-
completeValue(
1194+
completedResults.push(
1195+
completePromiseCatchingErrors(
11961196
exeContext,
11971197
itemType,
11981198
fieldNodes,
11991199
info,
12001200
itemPath,
1201-
resolved,
1201+
item,
12021202
asyncPayloadRecord,
12031203
),
12041204
);
12051205

1206-
// Note: we don't rely on a `catch` method, but we do expect "thenable"
1207-
// to take a second callback for the error case.
1208-
completedResults.push(
1209-
completedItem.then(undefined, (rawError) => {
1210-
const error = locatedError(rawError, fieldNodes, pathToArray(itemPath));
1211-
const handledError = handleFieldError(error, itemType, errors);
1212-
filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord);
1213-
return handledError;
1214-
}),
1215-
);
1216-
12171206
return true;
12181207
}
12191208

0 commit comments

Comments
 (0)