@@ -599,14 +599,14 @@ function executeField(
599599 // Note: we don't rely on a `catch` method, but we do expect "thenable"
600600 // to take a second callback for the error case.
601601 return completed . then ( undefined , ( rawError ) => {
602- const error = locatedError ( rawError , fieldGroup , pathToArray ( path ) ) ;
603- return handleFieldError ( error , returnType , path , exeContext ) ;
602+ handleFieldError ( rawError , exeContext , returnType , fieldGroup , path ) ;
603+ return null ;
604604 } ) ;
605605 }
606606 return completed ;
607607 } catch ( rawError ) {
608- const error = locatedError ( rawError , fieldGroup , pathToArray ( path ) ) ;
609- return handleFieldError ( error , returnType , path , exeContext ) ;
608+ handleFieldError ( rawError , exeContext , returnType , fieldGroup , path ) ;
609+ return null ;
610610 }
611611}
612612
@@ -638,11 +638,14 @@ export function buildResolveInfo(
638638}
639639
640640function handleFieldError (
641- error : GraphQLError ,
641+ rawError : unknown ,
642+ exeContext : ExecutionContext ,
642643 returnType : GraphQLOutputType ,
644+ fieldGroup : FieldGroup ,
643645 path : Path ,
644- exeContext : ExecutionContext ,
645- ) : null {
646+ ) : void {
647+ const error = locatedError ( rawError , fieldGroup , pathToArray ( path ) ) ;
648+
646649 // If the field type is non-nullable, then it is resolved without any
647650 // protection from errors, however it still properly locates the error.
648651 if ( isNonNullType ( returnType ) ) {
@@ -652,7 +655,6 @@ function handleFieldError(
652655 // Otherwise, error protection is applied, logging the error and resolving
653656 // a null value for this field if one is encountered.
654657 exeContext . collectedErrors . add ( error , path ) ;
655- return null ;
656658}
657659
658660/**
@@ -785,8 +787,8 @@ async function completePromisedValue(
785787 }
786788 return completed ;
787789 } catch ( rawError ) {
788- const error = locatedError ( rawError , fieldGroup , pathToArray ( path ) ) ;
789- return handleFieldError ( error , returnType , path , exeContext ) ;
790+ handleFieldError ( rawError , exeContext , returnType , fieldGroup , path ) ;
791+ return null ;
790792 }
791793}
792794
@@ -816,9 +818,8 @@ async function completeAsyncIteratorValue(
816818 break ;
817819 }
818820 } catch ( rawError ) {
821+ handleFieldError ( rawError , exeContext , itemType , fieldGroup , itemPath ) ;
819822 completedResults . push ( null ) ;
820- const error = locatedError ( rawError , fieldGroup , pathToArray ( itemPath ) ) ;
821- handleFieldError ( error , itemType , itemPath , exeContext ) ;
822823 break ;
823824 }
824825
@@ -947,12 +948,14 @@ function completeListItemValue(
947948 // to take a second callback for the error case.
948949 completedResults . push (
949950 completedItem . then ( undefined , ( rawError ) => {
950- const error = locatedError (
951+ handleFieldError (
951952 rawError ,
953+ exeContext ,
954+ itemType ,
952955 fieldGroup ,
953- pathToArray ( itemPath ) ,
956+ itemPath ,
954957 ) ;
955- return handleFieldError ( error , itemType , itemPath , exeContext ) ;
958+ return null ;
956959 } ) ,
957960 ) ;
958961
@@ -961,14 +964,8 @@ function completeListItemValue(
961964
962965 completedResults . push ( completedItem ) ;
963966 } catch ( rawError ) {
964- const error = locatedError ( rawError , fieldGroup , pathToArray ( itemPath ) ) ;
965- const handledError = handleFieldError (
966- error ,
967- itemType ,
968- itemPath ,
969- exeContext ,
970- ) ;
971- completedResults . push ( handledError ) ;
967+ handleFieldError ( rawError , exeContext , itemType , fieldGroup , itemPath ) ;
968+ completedResults . push ( null ) ;
972969 }
973970
974971 return false ;
0 commit comments