@@ -116,7 +116,7 @@ export interface ExecutionContext {
116116 typeResolver : GraphQLTypeResolver < any , any > ;
117117 subscribeFieldResolver : GraphQLFieldResolver < any , any > ;
118118 errors : Array < GraphQLError > ;
119- errorBehavior : 'PROPAGATE' | 'NULL ' | 'ABORT' ;
119+ errorBehavior : 'PROPAGATE' | 'NO_PROPAGATE ' | 'ABORT' ;
120120}
121121
122122/**
@@ -155,14 +155,14 @@ export interface ExecutionArgs {
155155 typeResolver ?: Maybe < GraphQLTypeResolver < any , any > > ;
156156 subscribeFieldResolver ?: Maybe < GraphQLFieldResolver < any , any > > ;
157157 /**
158- * Experimental. Set to NULL to prevent error propagation. Set to ABORT to
158+ * Experimental. Set to NO_PROPAGATE to prevent error propagation. Set to ABORT to
159159 * abort a request when any error occurs.
160160 *
161161 * Default: PROPAGATE
162162 *
163163 * @experimental
164164 */
165- errorBehavior ?: 'PROPAGATE' | 'NULL ' | 'ABORT' ;
165+ onError ?: 'PROPAGATE' | 'NO_PROPAGATE ' | 'ABORT' ;
166166}
167167
168168/**
@@ -297,9 +297,22 @@ export function buildExecutionContext(
297297 fieldResolver,
298298 typeResolver,
299299 subscribeFieldResolver,
300- errorBehavior ,
300+ onError ,
301301 } = args ;
302302
303+ if (
304+ onError != null &&
305+ onError !== 'PROPAGATE' &&
306+ onError !== 'NO_PROPAGATE' &&
307+ onError !== 'ABORT'
308+ ) {
309+ return [
310+ new GraphQLError (
311+ 'Unsupported `onError` value; supported values are `PROPAGATE`, `NO_PROPAGATE` and `ABORT`.' ,
312+ ) ,
313+ ] ;
314+ }
315+
303316 let operation : OperationDefinitionNode | undefined ;
304317 const fragments : ObjMap < FragmentDefinitionNode > = Object . create ( null ) ;
305318 for ( const definition of document . definitions ) {
@@ -359,7 +372,7 @@ export function buildExecutionContext(
359372 typeResolver : typeResolver ?? defaultTypeResolver ,
360373 subscribeFieldResolver : subscribeFieldResolver ?? defaultFieldResolver ,
361374 errors : [ ] ,
362- errorBehavior : errorBehavior ?? 'PROPAGATE' ,
375+ errorBehavior : onError ?? 'PROPAGATE' ,
363376 } ;
364377}
365378
@@ -618,7 +631,7 @@ function handleFieldError(
618631 } else if ( exeContext . errorBehavior === 'ABORT' ) {
619632 // In this mode, any error aborts the request
620633 throw error ;
621- } else if ( exeContext . errorBehavior === 'NULL ' ) {
634+ } else if ( exeContext . errorBehavior === 'NO_PROPAGATE ' ) {
622635 // In this mode, the client takes responsibility for error handling, so we
623636 // treat the field as if it were nullable.
624637 } else {
0 commit comments