Cannot override SimpleDataFetcherExceptionHandler
See original GitHub issueHi, Thank you for this great implementation. I am using version 7.0.1. Facing problem with exception handling. Tried lots of different ways. like this one: https://github.com/leangen/graphql-spqr/issues/219
`@Configuration public class GraphQLConfig {
@Bean
public GraphQL graphQL(GraphQLSchema schema)
{
return GraphQL.newGraphQL(schema)
.queryExecutionStrategy(new AsyncExecutionStrategy(new CustomExceptionHandler()))
.mutationExecutionStrategy(new AsyncSerialExecutionStrategy(new CustomExceptionHandler()))
.build();
}
}Also have
public class CustomExceptionHandler implements DataFetcherExceptionHandler {
@Override public DataFetcherExceptionHandlerResult onException( DataFetcherExceptionHandlerParameters handlerParameters) {
Throwable exception = handlerParameters.getException();
// do something with exception
System.out.println("asdadad");
GraphQLError error = GraphqlErrorBuilder.newError().message(exception.getMessage()).build();
return DataFetcherExceptionHandlerResult.newResult().error(error).build();
} }`
My CustomExceptionHandler is not triggering. Please, help to solve this issue. P.S: I am new in GraphQL, also sorry my english.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Thank you very much. If someone looking code example:
You could create a custom implementation of
GraphQLError
and return that. If you returnnull
for thelocations
and just limit the values returned bygetExtensions()
you should get the result you’re after.