@@ -369,7 +369,6 @@ function executeImpl(
369
369
} ,
370
370
) ;
371
371
}
372
-
373
372
const initialResult = buildResponse ( result , exeContext . errors ) ;
374
373
if ( exeContext . subsequentPayloads . size > 0 ) {
375
374
return {
@@ -688,6 +687,7 @@ function executeField(
688
687
path : Path ,
689
688
asyncPayloadRecord ?: AsyncPayloadRecord ,
690
689
) : PromiseOrValue < unknown > {
690
+ const errors = asyncPayloadRecord ?. errors ?? exeContext . errors ;
691
691
const fieldName = fieldNodes [ 0 ] . name . value ;
692
692
const fieldDef = exeContext . schema . getField ( parentType , fieldName ) ;
693
693
if ( ! fieldDef ) {
@@ -747,7 +747,6 @@ function executeField(
747
747
748
748
if ( isPromise ( completed ) ) {
749
749
return catchAfter ( completed , ( rawError ) => {
750
- const errors = asyncPayloadRecord ?. errors ?? exeContext . errors ;
751
750
const error = locatedError ( rawError , fieldNodes , pathToArray ( path ) ) ;
752
751
const handledError = handleFieldError ( error , returnType , errors ) ;
753
752
filterSubsequentPayloads ( exeContext , path , asyncPayloadRecord ) ;
@@ -756,7 +755,6 @@ function executeField(
756
755
}
757
756
return completed ;
758
757
} catch ( rawError ) {
759
- const errors = asyncPayloadRecord ?. errors ?? exeContext . errors ;
760
758
const error = locatedError ( rawError , fieldNodes , pathToArray ( path ) ) ;
761
759
const handledError = handleFieldError ( error , returnType , errors ) ;
762
760
filterSubsequentPayloads ( exeContext , path , asyncPayloadRecord ) ;
@@ -2042,9 +2040,8 @@ async function executeStreamIteratorItem(
2042
2040
2043
2041
if ( isPromise ( completedItem ) ) {
2044
2042
completedItem = catchAfter ( completedItem , ( rawError ) => {
2045
- const errors = asyncPayloadRecord ?. errors ?? exeContext . errors ;
2046
2043
const error = locatedError ( rawError , fieldNodes , pathToArray ( itemPath ) ) ;
2047
- const handledError = handleFieldError ( error , itemType , errors ) ;
2044
+ const handledError = handleFieldError ( error , itemType , asyncPayloadRecord . errors ) ;
2048
2045
filterSubsequentPayloads ( exeContext , itemPath , asyncPayloadRecord ) ;
2049
2046
return handledError ;
2050
2047
} ) ;
0 commit comments