@@ -51,6 +51,7 @@ public class GraphQLEngine
5151 private IErrorTransformation _errorTransformation = new DefaultErrorTransformation ( ) ;
5252
5353 private bool _includeFieldDescriptions ;
54+ private bool _throwUnhandledExceptions ;
5455
5556 private bool _includeFieldDeprecationReasons ;
5657
@@ -208,6 +209,12 @@ public GraphQLEngine PrintFieldDescriptions(bool include = true)
208209 return this ;
209210 }
210211
212+ public GraphQLEngine ThrowUnhandledExceptions ( bool throwUnhandledExceptions = true )
213+ {
214+ _throwUnhandledExceptions = throwUnhandledExceptions ;
215+ return this ;
216+ }
217+
211218 public GraphQLEngine PrintFieldDeprecationReasons ( bool include = true )
212219 {
213220 _includeFieldDeprecationReasons = include ;
@@ -297,12 +304,13 @@ internal async Task<ExecutionResult> ExecuteAsync(
297304 EnableMetrics = enableProfiling ,
298305 UserContext = new Dictionary < string , object > ( )
299306 {
300- { typeof ( IUserContext ) . FullName ?? nameof ( IUserContext ) , userContext } ,
301- { typeof ( IDependencyInjector ) . FullName ?? nameof ( IDependencyInjector ) , dependencyInjector } ,
307+ { typeof ( IUserContext ) . FullName ?? nameof ( IUserContext ) , userContext } ,
308+ { typeof ( IDependencyInjector ) . FullName ?? nameof ( IDependencyInjector ) , dependencyInjector } ,
302309 } ,
303310 ValidationRules = validationRules . Any ( ) ? validationRules : null ,
304311 ComplexityConfiguration = complexityConfiguration ,
305312 CancellationToken = cancellationToken ,
313+ ThrowOnUnhandledException = _throwUnhandledExceptions ,
306314 } ;
307315
308316 if ( listeners != null )
0 commit comments