Package graphql.execution
Class SimpleDataFetcherExceptionHandler
- java.lang.Object
-
- graphql.execution.SimpleDataFetcherExceptionHandler
-
- All Implemented Interfaces:
DataFetcherExceptionHandler
@PublicApi public class SimpleDataFetcherExceptionHandler extends java.lang.Object implements DataFetcherExceptionHandler
The standard handling of data fetcher error involves placing aExceptionWhileDataFetching
error into the error collection
-
-
Constructor Summary
Constructors Constructor Description SimpleDataFetcherExceptionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<DataFetcherExceptionHandlerResult>
handleException(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, java.lang.Throwable exception)
Called to log the exception - a subclass could choose to something different in logging termsprotected java.lang.Throwable
unwrap(java.lang.Throwable exception)
Called to unwrap an exception to a more suitable cause if required.
-
-
-
Method Detail
-
handleException
public java.util.concurrent.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
protected void logException(ExceptionWhileDataFetching error, java.lang.Throwable exception)
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
protected java.lang.Throwable unwrap(java.lang.Throwable exception)
Called to unwrap an exception to a more suitable cause if required.- Parameters:
exception
- the exception to unwrap- Returns:
- the suitable exception
-
-