Interface HandlerDataFetcherExceptionResolver

All Superinterfaces:
DataFetcherExceptionResolver

public interface HandlerDataFetcherExceptionResolver extends DataFetcherExceptionResolver
Extension of DataFetcherExceptionResolver with overloaded method to apply at the point of DataFetcher invocation to allow local exception handling.
Since:
1.3.0
Author:
Rossen Stoyanchev
  • Method Summary

    Modifier and Type
    Method
    Description
    default reactor.core.publisher.Mono<List<graphql.GraphQLError>>
    resolveException(Throwable exception, graphql.schema.DataFetchingEnvironment environment)
    Resolve the given exception and return the error(s) to add to the response.
    reactor.core.publisher.Mono<List<graphql.GraphQLError>>
    resolveException(Throwable ex, graphql.schema.DataFetchingEnvironment environment, Object handler)
    Resolve an exception raised by the given handler.
  • Method Details

    • resolveException

      default reactor.core.publisher.Mono<List<graphql.GraphQLError>> resolveException(Throwable exception, graphql.schema.DataFetchingEnvironment environment)
      Description copied from interface: DataFetcherExceptionResolver
      Resolve the given exception and return the error(s) to add to the response.

      Implementations can use GraphqlErrorBuilder.newError(DataFetchingEnvironment) to create an error with the coordinates of the target field, and use ErrorType to specify a category for the error.

      Specified by:
      resolveException in interface DataFetcherExceptionResolver
      Parameters:
      exception - the exception to resolve
      environment - the environment for the invoked DataFetcher
      Returns:
      a Mono with errors to add to the GraphQL response; if the Mono completes with an empty List, the exception is resolved without any errors added to the response; if the Mono completes empty, without emitting a List, the exception remains unresolved and that allows other resolvers to resolve it.
    • resolveException

      reactor.core.publisher.Mono<List<graphql.GraphQLError>> resolveException(Throwable ex, graphql.schema.DataFetchingEnvironment environment, @Nullable Object handler)
      Resolve an exception raised by the given handler.
      Parameters:
      ex - the exception to resolve
      environment - the environment for the invoked DataFetcher
      handler - the handler that raised the exception, if applicable
      Returns:
      a Mono with resolved GraphQLErrors as specified in DataFetcherExceptionResolver.resolveException(Throwable, DataFetchingEnvironment)