This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Description
I am trying to use the new feature to use ExceptionHandlers to map exceptions to nicer errors in graphql. I am not that successful with it though.
I changed graphql.servlet.exception-handlers-enabled to true and see that errors are handled differently, so that is good.
I then made my own handler for my own exception type I tried both:
@Configuration
class ErrorConfig() {
@ExceptionHandler
fun handle(exception: ClientException): ThrowableGraphQLError {
return ThrowableGraphQLError(exception, exception.description)
}
}
and
@Configuration
class ErrorConfig() {
@Bean
fun customErrorHandler() = CustomErrorHandler()
}
class CustomErrorHandler() {
@ExceptionHandler(ClientException::class)
fun handle(exception: ClientException): GraphQLError {
return ThrowableGraphQLError(exception, exception.description)
}
}
Neither seems to work. I debugged a bit and GraphQLErrorHandlerFactory seems to be the factory that makes the errorhandlers, which are used in GraphQLErrorFromExceptionHandler. However this factory is called before my bean is created which leads List<GraphQLErrorFactory> factories to be empty and default back to the default error.
Do i miss something?