@@ -518,7 +518,7 @@ export function validateExecutionArgs(
518518 } = args ;
519519
520520 if ( abortSignal ?. aborted ) {
521- return [ locatedError ( new Error ( abortSignal . reason ) , undefined ) ] ;
521+ return [ new GraphQLError ( ( abortSignal . reason as string ) || 'Aborted' ) ] ;
522522 }
523523
524524 // If the schema used for execution is invalid, throw an error.
@@ -667,16 +667,9 @@ function executeFieldsSerially(
667667 const fieldPath = addPath ( path , responseName , parentType . name ) ;
668668 const abortSignal = exeContext . validatedExecutionArgs . abortSignal ;
669669 if ( abortSignal ?. aborted ) {
670- handleFieldError (
671- new Error ( abortSignal . reason ) ,
672- exeContext ,
673- parentType ,
674- fieldDetailsList ,
675- fieldPath ,
676- incrementalContext ,
677- ) ;
678- graphqlWrappedResult [ 0 ] [ responseName ] = null ;
679- return graphqlWrappedResult ;
670+ throw new GraphQLError ( ( abortSignal . reason as string ) || 'Aborted' , {
671+ path : undefined ,
672+ } ) ;
680673 }
681674
682675 const result = executeField (
@@ -731,11 +724,9 @@ function executeFields(
731724 const fieldPath = addPath ( path , responseName , parentType . name ) ;
732725 const abortSignal = exeContext . validatedExecutionArgs . abortSignal ;
733726 if ( abortSignal ?. aborted ) {
734- throw locatedError (
735- new Error ( abortSignal . reason ) ,
736- toNodes ( fieldDetailsList ) ,
737- pathToArray ( fieldPath ) ,
738- ) ;
727+ throw new GraphQLError ( ( abortSignal . reason as string ) || 'Aborted' , {
728+ path : undefined ,
729+ } ) ;
739730 }
740731
741732 const result = executeField (
@@ -934,10 +925,11 @@ function handleFieldError(
934925 path : Path ,
935926 incrementalContext : IncrementalContext | undefined ,
936927) : void {
928+ const isAborted = exeContext . validatedExecutionArgs . abortSignal ?. aborted ;
937929 const error = locatedError (
938930 rawError ,
939- toNodes ( fieldDetailsList ) ,
940- pathToArray ( path ) ,
931+ isAborted ? undefined : toNodes ( fieldDetailsList ) ,
932+ isAborted ? undefined : pathToArray ( path ) ,
941933 ) ;
942934
943935 // If the field type is non-nullable, then it is resolved without any
0 commit comments