Skip to content

Commit b947554

Browse files
committed
Update documentation for SubscriptionExceptionResolver
Closes gh-398
1 parent 05ebd63 commit b947554

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

spring-graphql-docs/src/docs/asciidoc/index.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ the following:
258258
- Detect https://www.graphql-java.com/documentation/instrumentation[Instrumentation] beans for
259259
{spring-boot-ref-docs}/actuator.html#actuator.metrics.supported.spring-graphql[GraphQL metrics].
260260
- Detect `DataFetcherExceptionResolver` beans for <<execution-exceptions, exception resolution>>.
261+
- Detect `SubscriptionExceptionResolver` beans for <<execution-exceptions-subsctiption, subscription exception resolution>>.
261262

262263
For further customizations, you can declare your own `GraphQlSourceBuilderCustomizer` beans;
263264
for example, for configuring your own `ExecutionIdProvider`:
@@ -565,6 +566,22 @@ Unresolved exception are logged at ERROR level along with the `executionId` to c
565566
to the error sent to the client. Resolved exceptions are logged at DEBUG level.
566567

567568

569+
[[execution-exceptions-subsctiption]]
570+
==== Subscription Exceptions
571+
572+
The `Publisher` for a subscription request may complete with an error signal in which case
573+
the underlying transport (e.g. WebSocket) sends a final "error" type message with a list
574+
of GraphQL errors.
575+
576+
`DataFetcherExceptionResolver` cannot resolve errors from a subscription `Publisher`,
577+
since the data `DataFetcher` only creates the `Publisher` initially. After that, the
578+
transport subscribes to the `Publisher` that may then complete with an error.
579+
580+
An application can register a `SubscriptionExceptionResolver` in order to resolve
581+
exceptions from a subscription `Publisher` in order to resolve those to GraphQL errors
582+
to send to the client.
583+
584+
568585

569586
[[execution-batching]]
570587
=== Batch Loading

0 commit comments

Comments
 (0)