public abstract class SubscriptionExceptionResolverAdapter extends Object implements SubscriptionExceptionResolver
SubscriptionExceptionResolver
that pre-implements the
asynchronous contract and exposes the following synchronous protected methods:
Applications may also use
SubscriptionExceptionResolver.forSingleError(Function)
as a shortcut
for resolveToSingleError(Throwable)
.
SubscriptionExceptionResolver
Constructor and Description |
---|
SubscriptionExceptionResolverAdapter() |
Modifier and Type | Method and Description |
---|---|
boolean |
isThreadLocalContextAware()
Whether ThreadLocal context needs to be restored for this resolver.
|
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. |
protected List<GraphQLError> |
resolveToMultipleErrors(Throwable exception)
Override this method to resolve the Exception to multiple GraphQL errors.
|
protected GraphQLError |
resolveToSingleError(Throwable exception)
Override this method to resolve the Exception to a single GraphQL error.
|
void |
setThreadLocalContextAware(boolean threadLocalContextAware)
Subclasses can set this to indicate that ThreadLocal context from the
transport handler (e.g.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forSingleError
public SubscriptionExceptionResolverAdapter()
public void setThreadLocalContextAware(boolean threadLocalContextAware)
Note: This property is applicable only if transports
use ThreadLocal's' (e.g. Spring MVC) and if a ThreadLocalAccessor
is registered to extract ThreadLocal values of interest. There is no
impact from setting this property otherwise.
By default this is set to "false" in which case there is no attempt to propagate ThreadLocal context.
threadLocalContextAware
- whether this resolver needs access to
ThreadLocal context or not.public boolean isThreadLocalContextAware()
public final reactor.core.publisher.Mono<List<GraphQLError>> resolveException(Throwable exception)
SubscriptionExceptionResolver
GraphQLError
's to be
sent in an error message to the client.resolveException
in interface SubscriptionExceptionResolver
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.@Nullable protected List<GraphQLError> resolveToMultipleErrors(Throwable exception)
exception
- the exception to resolvenull
if unresolved@Nullable protected GraphQLError resolveToSingleError(Throwable exception)
exception
- the exception to resolvenull
if unresolved