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 aDataFetcherthen this handler is called to shape the errors that should be placed in theExecutionResult.getErrors()list of errors.protected voidlogException(ExceptionWhileDataFetching error, Throwable exception) Called to log the exception - a subclass could choose to something different in logging termsprotected ThrowableCalled 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:DataFetcherExceptionHandlerWhen an exception occurs during a call to aDataFetcherthen this handler is called to shape the errors that should be placed in theExecutionResult.getErrors()list of errors.- Specified by:
handleExceptionin interfaceDataFetcherExceptionHandler- Parameters:
handlerParameters- the parameters to this callback- Returns:
- a result that can contain custom formatted
GraphQLErrors
-
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
-