@FunctionalInterface public interface SubscriptionExceptionResolver
Publisher ends with an error.
Resolver implementations can extend the convenience base class
SubscriptionExceptionResolverAdapter and override one of its methods
resolveToSingleError or
resolveToMultipleErrors
that resolve the exception synchronously.
Resolved errors are wrapped in a SubscriptionPublisherException
and propagated further to the underlying transport which access the errors
and prepare a final error message to send to the client.
SubscriptionExceptionResolverAdapter| Modifier and Type | Method and Description |
|---|---|
static SubscriptionExceptionResolverAdapter |
forSingleError(Function<Throwable,GraphQLError> resolver)
Factory method to create a
SubscriptionExceptionResolver to
resolve an exception to a single GraphQL error. |
reactor.core.publisher.Mono<List<GraphQLError>> |
resolveException(Throwable exception)
Resolve the given exception to a list of
GraphQLError's to be
sent in an error message to the client. |
reactor.core.publisher.Mono<List<GraphQLError>> resolveException(Throwable exception)
GraphQLError's to be
sent in an error message to the client.exception - the exception from the PublisherMono with the GraphQL errors to send to the client;
if the Mono completes with an empty List, the exception is resolved
without any errors to send; if the Mono completes empty, without
emitting a List, the exception remains unresolved, and that allows other
resolvers to resolve it.static SubscriptionExceptionResolverAdapter forSingleError(Function<Throwable,GraphQLError> resolver)
SubscriptionExceptionResolver to
resolve an exception to a single GraphQL error. Effectively, a shortcut
for creating SubscriptionExceptionResolverAdapter and overriding
its resolveToSingleError method.resolver - the resolver function to map the exception