Skip to content

Commit f1ba488

Browse files
committed
reduce diff
1 parent 438b29a commit f1ba488

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/execution/execute.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ function executeImpl(
369369
},
370370
);
371371
}
372-
373372
const initialResult = buildResponse(result, exeContext.errors);
374373
if (exeContext.subsequentPayloads.size > 0) {
375374
return {
@@ -688,6 +687,7 @@ function executeField(
688687
path: Path,
689688
asyncPayloadRecord?: AsyncPayloadRecord,
690689
): PromiseOrValue<unknown> {
690+
const errors = asyncPayloadRecord?.errors ?? exeContext.errors;
691691
const fieldName = fieldNodes[0].name.value;
692692
const fieldDef = exeContext.schema.getField(parentType, fieldName);
693693
if (!fieldDef) {
@@ -747,7 +747,6 @@ function executeField(
747747

748748
if (isPromise(completed)) {
749749
return catchAfter(completed, (rawError) => {
750-
const errors = asyncPayloadRecord?.errors ?? exeContext.errors;
751750
const error = locatedError(rawError, fieldNodes, pathToArray(path));
752751
const handledError = handleFieldError(error, returnType, errors);
753752
filterSubsequentPayloads(exeContext, path, asyncPayloadRecord);
@@ -756,7 +755,6 @@ function executeField(
756755
}
757756
return completed;
758757
} catch (rawError) {
759-
const errors = asyncPayloadRecord?.errors ?? exeContext.errors;
760758
const error = locatedError(rawError, fieldNodes, pathToArray(path));
761759
const handledError = handleFieldError(error, returnType, errors);
762760
filterSubsequentPayloads(exeContext, path, asyncPayloadRecord);
@@ -2042,9 +2040,8 @@ async function executeStreamIteratorItem(
20422040

20432041
if (isPromise(completedItem)) {
20442042
completedItem = catchAfter(completedItem, (rawError) => {
2045-
const errors = asyncPayloadRecord?.errors ?? exeContext.errors;
20462043
const error = locatedError(rawError, fieldNodes, pathToArray(itemPath));
2047-
const handledError = handleFieldError(error, itemType, errors);
2044+
const handledError = handleFieldError(error, itemType, asyncPayloadRecord.errors);
20482045
filterSubsequentPayloads(exeContext, itemPath, asyncPayloadRecord);
20492046
return handledError;
20502047
});

0 commit comments

Comments
 (0)