Skip to content

Commit 2ba85cb

Browse files
committed
remove errors from parameters to completeListItemValue
1 parent 78d7a21 commit 2ba85cb

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/execution/execute.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,6 @@ async function completeAsyncIteratorValue(
10251025
iterator: AsyncIterator<unknown>,
10261026
asyncPayloadRecord?: AsyncPayloadRecord,
10271027
): Promise<ReadonlyArray<unknown>> {
1028-
const errors = asyncPayloadRecord?.errors ?? exeContext.errors;
10291028
const stream = getStreamValues(exeContext, fieldNodes, path);
10301029
let containsPromise = false;
10311030
const completedResults: Array<unknown> = [];
@@ -1058,6 +1057,10 @@ async function completeAsyncIteratorValue(
10581057
// eslint-disable-next-line no-await-in-loop
10591058
iteration = await iterator.next();
10601059
} catch (rawError) {
1060+
// FIXME: add coverage for non-streamed async iterator error within a deferred payload
1061+
const errors =
1062+
/* c8 ignore start */ asyncPayloadRecord?.errors ??
1063+
/* c8 ignore stop */ exeContext.errors;
10611064
addError(rawError, fieldNodes, itemType, itemPath, errors);
10621065
completedResults.push(null);
10631066
break;
@@ -1071,7 +1074,6 @@ async function completeAsyncIteratorValue(
10711074
completeListItemValue(
10721075
iteration.value,
10731076
completedResults,
1074-
errors,
10751077
exeContext,
10761078
itemType,
10771079
fieldNodes,
@@ -1101,7 +1103,6 @@ function completeListValue(
11011103
asyncPayloadRecord?: AsyncPayloadRecord,
11021104
): PromiseOrValue<ReadonlyArray<unknown>> {
11031105
const itemType = returnType.ofType;
1104-
const errors = asyncPayloadRecord?.errors ?? exeContext.errors;
11051106

11061107
if (isAsyncIterable(result)) {
11071108
const iterator = result[Symbol.asyncIterator]();
@@ -1160,7 +1161,6 @@ function completeListValue(
11601161
completeListItemValue(
11611162
item,
11621163
completedResults,
1163-
errors,
11641164
exeContext,
11651165
itemType,
11661166
fieldNodes,
@@ -1186,7 +1186,6 @@ function completeListValue(
11861186
function completeListItemValue(
11871187
item: unknown,
11881188
completedResults: Array<unknown>,
1189-
errors: Array<GraphQLError>,
11901189
exeContext: ExecutionContext,
11911190
itemType: GraphQLOutputType,
11921191
fieldNodes: ReadonlyArray<FieldNode>,
@@ -1226,6 +1225,10 @@ function completeListItemValue(
12261225
// to take a second callback for the error case.
12271226
completedResults.push(
12281227
completedItem.then(undefined, (rawError) => {
1228+
// FIXME: add coverage for async rejection of a promise item within a deferred payload
1229+
const errors =
1230+
/* c8 ignore start */ asyncPayloadRecord?.errors ??
1231+
/* c8 ignore stop */ exeContext.errors;
12291232
addError(rawError, fieldNodes, itemType, itemPath, errors);
12301233
filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord);
12311234
return null;
@@ -1237,6 +1240,10 @@ function completeListItemValue(
12371240

12381241
completedResults.push(completedItem);
12391242
} catch (rawError) {
1243+
// FIXME: add coverage for sync rejection of a promise item within a deferred payload
1244+
const errors =
1245+
/* c8 ignore start */ asyncPayloadRecord?.errors ??
1246+
/* c8 ignore stop */ exeContext.errors;
12401247
addError(rawError, fieldNodes, itemType, itemPath, errors);
12411248
filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord);
12421249
completedResults.push(null);

0 commit comments

Comments
 (0)