@@ -394,7 +394,7 @@ export function experimentalExecuteQueryOrMutationOrSubscriptionEvent(
394
394
exeContext . abortSignalListener ?. disconnect ( ) ;
395
395
return {
396
396
data : null ,
397
- errors : addError ( exeContext . errors , error as GraphQLError ) ,
397
+ errors : [ ... exeContext . errors , error as GraphQLError ] ,
398
398
} ;
399
399
} ,
400
400
) ;
@@ -406,18 +406,10 @@ export function experimentalExecuteQueryOrMutationOrSubscriptionEvent(
406
406
// TODO: add test case for synchronous null bubbling to root with cancellation
407
407
/* c8 ignore next */
408
408
exeContext . abortSignalListener ?. disconnect ( ) ;
409
- return { data : null , errors : addError ( exeContext . errors , error ) } ;
409
+ return { data : null , errors : [ ... exeContext . errors , error ] } ;
410
410
}
411
411
}
412
412
413
- function addError (
414
- errors : Array < GraphQLError > ,
415
- error : GraphQLError ,
416
- ) : ReadonlyArray < GraphQLError > {
417
- errors . push ( error ) ;
418
- return errors ;
419
- }
420
-
421
413
function buildDataResponse (
422
414
exeContext : ExecutionContext ,
423
415
graphqlWrappedResult : GraphQLWrappedResult < ObjMap < unknown > > ,
@@ -1006,7 +998,7 @@ function handleFieldError(
1006
998
// Otherwise, error protection is applied, logging the error and resolving
1007
999
// a null value for this field if one is encountered.
1008
1000
const context = incrementalContext ?? exeContext ;
1009
- addError ( context . errors , error ) ;
1001
+ context . errors . push ( error ) ;
1010
1002
}
1011
1003
1012
1004
/**
@@ -2458,7 +2450,7 @@ function executeExecutionGroup(
2458
2450
return {
2459
2451
pendingExecutionGroup,
2460
2452
path : pathToArray ( path ) ,
2461
- errors : addError ( incrementalContext . errors , error ) ,
2453
+ errors : [ ... incrementalContext . errors , error ] ,
2462
2454
} ;
2463
2455
}
2464
2456
@@ -2478,7 +2470,7 @@ function executeExecutionGroup(
2478
2470
return {
2479
2471
pendingExecutionGroup,
2480
2472
path : pathToArray ( path ) ,
2481
- errors : addError ( incrementalContext . errors , error as GraphQLError ) ,
2473
+ errors : [ ... incrementalContext . errors , error as GraphQLError ] ,
2482
2474
} ;
2483
2475
} ,
2484
2476
) ;
@@ -2720,7 +2712,7 @@ function completeStreamItem(
2720
2712
( error : unknown ) => {
2721
2713
incrementalContext . completed = true ;
2722
2714
return {
2723
- errors : addError ( incrementalContext . errors , error as GraphQLError ) ,
2715
+ errors : [ ... incrementalContext . errors , error as GraphQLError ] ,
2724
2716
} ;
2725
2717
} ,
2726
2718
) ;
@@ -2753,7 +2745,7 @@ function completeStreamItem(
2753
2745
} catch ( error ) {
2754
2746
incrementalContext . completed = true ;
2755
2747
return {
2756
- errors : addError ( incrementalContext . errors , error ) ,
2748
+ errors : [ ... incrementalContext . errors , error ] ,
2757
2749
} ;
2758
2750
}
2759
2751
@@ -2778,7 +2770,7 @@ function completeStreamItem(
2778
2770
( error : unknown ) => {
2779
2771
incrementalContext . completed = true ;
2780
2772
return {
2781
- errors : addError ( incrementalContext . errors , error as GraphQLError ) ,
2773
+ errors : [ ... incrementalContext . errors , error as GraphQLError ] ,
2782
2774
} ;
2783
2775
} ,
2784
2776
) ;
0 commit comments