This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
No location and path in error response #453
Closed
Description
Implementation of graphql.execution.SimpleDataFetcherExceptionHandler
puts location and path to error
object.
However, graphql.kickstart.spring.error.GraphQLErrorFromExceptionHandler
clears that information, and error contains only a message.
From GraphQLErrorFromExceptionHandler
:
private Collection<GraphQLError> transform(GraphQLError error) {
return extractException(error).map(this::transform)
.orElse(singletonList(new GenericGraphQLError(error.getMessage())));
}
This code extract exception and build new GraphQLError
object without location
and path
.
Alternatively, ther is no way to get location and path in handling exception like this
@ExceptionHandler(Exception.class)
GraphQLError handleGenericException(Exception ex) {
return new ThrowableGraphQLError(ex, ex.getMessage());
}