@@ -161,8 +161,9 @@ Returns either a synchronous ExecutionResult (if all encountered resolvers
161161are synchronous), or a Promise of an ExecutionResult that will eventually be
162162resolved and never rejected.
163163
164- If the arguments to this function do not result in a legal execution context,
165- a GraphQLError will be thrown immediately explaining the invalid input.
164+ If the schema is invalid, an error will be thrown immediately. GraphQL
165+ request errors, including missing operations and variable coercion errors,
166+ are returned in an errors-only ExecutionResult.
166167
167168Field errors are collected into the response instead of rejecting the
168169returned promise. Only the field that produced the error and its descendants
@@ -251,17 +252,18 @@ result; // => { data: { greeting: 'Hello, Ada!' } }
251252
252253Implements the "Executing operations" section of the spec.
253254
254- Returns a Promise that will eventually resolve to the data described by
255- The "Response" section of the GraphQL specification.
255+ Returns either a synchronous ExecutionResult, or a Promise for an
256+ ExecutionResult, described by the "Response" section of the GraphQL
257+ specification.
256258
257- If errors are encountered while executing a GraphQL field, only that
258- field and its descendants will be omitted, and sibling fields will still
259- be executed. An execution which encounters errors will still result in a
260- resolved Promise .
259+ If errors are encountered while executing a GraphQL field, only that field
260+ and its descendants will be omitted, and sibling fields will still be
261+ executed. These field errors are collected into the returned result instead
262+ of being thrown or rejecting the returned promise .
261263
262- Errors from sub-fields of a NonNull type may propagate to the top level,
263- at which point we still log the error and null the parent field, which
264- in this case is the entire response.
264+ Errors from sub-fields of a NonNull type may propagate to the top level, at
265+ which point we still collect the error and null the parent field, which in
266+ this case is the entire response.
265267
266268** Signature:**
267269
@@ -408,6 +410,9 @@ result; // => { data: { greeting: 'Hello' } }
408410
409411Executes a subscription operation once for a single source event.
410412
413+ Field errors are collected into the returned result instead of being thrown
414+ or rejecting the returned promise.
415+
411416** Signature:**
412417
413418<ApiSignature parts = { [[" name" , " executeSubscriptionEvent" ], " (\n " , [" parameter" , " validatedExecutionArgs" ], " : " , [" link" , " ValidatedSubscriptionArgs" , " /api-v17/execution#validatedsubscriptionargs" ], " ,\n ): " , [" type" , " PromiseOrValue" ], " \u003c " , [" link" , " ExecutionResult" , " /api-v17/execution#executionresult" ], " \u003e ;" ]} />
@@ -489,21 +494,22 @@ result; // => { data: { greeting: 'Hello' } }
489494
490495Implements the "Subscribe" algorithm described in the GraphQL specification.
491496
492- Returns a Promise that resolves to either an AsyncIterator (if successful)
493- or an ExecutionResult (error). The promise will be rejected if the schema or
494- other arguments to this function are invalid, or if the resolved event stream
495- is not an async iterable.
497+ Returns either an AsyncGenerator (if successful), an ExecutionResult (error),
498+ or a Promise for one of those results. The call will throw immediately if
499+ the schema is invalid or the selected operation is not a subscription.
496500
497- If the client-provided arguments to this function do not result in a
498- compliant subscription, a GraphQL Response (ExecutionResult) with descriptive
499- errors and no data will be returned .
501+ GraphQL request errors, including missing operations and variable coercion
502+ errors, return or resolve to a GraphQL Response (ExecutionResult) with
503+ descriptive errors and no data.
500504
501505If the source stream could not be created due to faulty subscription resolver
502- logic or underlying systems, the promise will resolve to a single
503- ExecutionResult containing ` errors ` and no ` data ` .
506+ logic, a non-async-iterable resolver result, or a system error, the
507+ function will return or resolve to a single ExecutionResult containing
508+ ` errors ` and no ` data ` .
504509
505- If the operation succeeded, the promise resolves to an AsyncIterator, which
506- yields a stream of ExecutionResults representing the response stream.
510+ If the operation succeeded, the function returns or resolves to an
511+ AsyncGenerator, which yields a stream of ExecutionResults representing the
512+ response stream.
507513
508514This function does not support incremental delivery (` @defer ` and ` @stream ` ).
509515If an operation which would defer or stream data is executed with this
@@ -657,21 +663,20 @@ Implements the "CreateSourceEventStream" algorithm described in the
657663GraphQL specification, resolving the subscription source event stream for a
658664previously validated subscription request.
659665
660- Returns a Promise that resolves to either an AsyncIterable (if successful)
661- or an ExecutionResult (error). The promise will be rejected if the validated
662- execution arguments are invalid, or if the resolved event stream is not an
663- async iterable.
666+ Returns either an AsyncIterable (if successful), an ExecutionResult (error),
667+ or a Promise for one of those results. The call will throw immediately if
668+ it is not passed validated execution arguments.
664669
665- If the client-provided arguments to this function do not result in a
666- compliant subscription, a GraphQL Response (ExecutionResult) with
667- descriptive errors and no data will be returned.
670+ If the validated arguments do not result in a compliant subscription, a
671+ GraphQL Response (ExecutionResult) with descriptive errors and no data will
672+ be returned.
668673
669674If the source stream could not be created due to faulty subscription
670- resolver logic or underlying systems , the promise will resolve to a single
671- ExecutionResult containing ` errors ` and no ` data ` .
675+ resolver logic or a system error , the function will return or
676+ resolve to a single ExecutionResult containing ` errors ` and no ` data ` .
672677
673- If the operation succeeded, the promise resolves to the AsyncIterable for the
674- event stream returned by the resolver.
678+ If the operation succeeded, the function returns or resolves to the
679+ AsyncIterable for the event stream returned by the resolver.
675680
676681A Source Event Stream represents a sequence of events, each of which triggers
677682a GraphQL execution for that event.
@@ -764,12 +769,11 @@ Symbol.asyncIterator in stream; // => true
764769
765770#### validateExecutionArgs()
766771
767- Constructs a ExecutionContext object from the arguments passed to
768- execute, which we will pass throughout the other execution methods.
769-
770- Throws a GraphQLError if a valid execution context cannot be created.
772+ Validates the arguments passed to execute, subscribe, and their lower-level
773+ helpers.
771774
772- TODO: consider no longer exporting this function
775+ Throws if the schema is invalid. GraphQL request errors, including variable
776+ coercion errors, are returned as a GraphQLError array.
773777
774778** Signature:**
775779
@@ -873,6 +877,10 @@ validatedArgs.hideSuggestions; // => true
873877
874878Validates execution arguments for a subscription operation.
875879
880+ Throws if the schema is invalid or the selected operation is not a
881+ subscription. GraphQL request errors, including variable coercion errors, are
882+ returned as a GraphQLError array.
883+
876884** Signature:**
877885
878886<ApiSignature parts = { [[" name" , " validateSubscriptionArgs" ], " (\n " , [" parameter" , " args" ], " : " , [" link" , " ExecutionArgs" , " /api-v17/execution#executionargs" ], " ,\n ): " , [" link" , " ValidatedSubscriptionArgs" , " /api-v17/execution#validatedsubscriptionargs" ], " \u007c " , [" keyword" , " readonly" ], " " , [" link" , " GraphQLError" , " /api-v17/error#graphqlerror" ], " [];" ]} />
@@ -1556,8 +1564,9 @@ This function returns either a single ExecutionResult, or an
15561564ExperimentalIncrementalExecutionResults object containing an ` initialResult `
15571565and a stream of ` subsequentResults ` .
15581566
1559- If the arguments to this function do not result in a legal execution context,
1560- a GraphQLError will be thrown immediately explaining the invalid input.
1567+ If the schema is invalid, an error will be thrown immediately. GraphQL
1568+ request errors, including missing operations and variable coercion errors,
1569+ are returned in an errors-only ExecutionResult.
15611570
15621571** Signature:**
15631572
0 commit comments