Package graphql.execution
Class SimpleDataFetcherExceptionHandler
java.lang.Object
graphql.execution.SimpleDataFetcherExceptionHandler
- All Implemented Interfaces:
DataFetcherExceptionHandler
@PublicApi
public class SimpleDataFetcherExceptionHandler
extends Object
implements DataFetcherExceptionHandler
The standard handling of data fetcher error involves placing a
ExceptionWhileDataFetching
error
into the error collection-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhandleException
(DataFetcherExceptionHandlerParameters handlerParameters) When an exception occurs during a call to aDataFetcher
then this handler is called to shape the errors that should be placed in theExecutionResult.getErrors()
list of errors.protected void
logException
(ExceptionWhileDataFetching error, Throwable exception) Called to log the exception - a subclass could choose to something different in logging termsprotected Throwable
Called to unwrap an exception to a more suitable cause if required.
-
Constructor Details
-
SimpleDataFetcherExceptionHandler
public SimpleDataFetcherExceptionHandler()
-
-
Method Details
-
handleException
public CompletableFuture<DataFetcherExceptionHandlerResult> handleException(DataFetcherExceptionHandlerParameters handlerParameters) Description copied from interface:DataFetcherExceptionHandler
When an exception occurs during a call to aDataFetcher
then this handler is called to shape the errors that should be placed in theExecutionResult.getErrors()
list of errors.- Specified by:
handleException
in interfaceDataFetcherExceptionHandler
- Parameters:
handlerParameters
- the parameters to this callback- Returns:
- a result that can contain custom formatted
GraphQLError
s
-
logException
Called to log the exception - a subclass could choose to something different in logging terms- Parameters:
error
- the graphql errorexception
- the exception that happened
-
unwrap
Called to unwrap an exception to a more suitable cause if required.- Parameters:
exception
- the exception to unwrap- Returns:
- the suitable exception
-