Closed
Description
I can not use there own ErrorClassification
java.lang.IllegalArgumentException: No enum constant org.springframework.graphql.execution.ErrorType.EntityNotFound
at java.base/java.lang.Enum.valueOf(Enum.java:293)
at org.springframework.graphql.execution.ErrorType.valueOf(ErrorType.java:30)
at org.springframework.graphql.client.ResponseMapGraphQlResponse$MapResponseError.getErrorType(ResponseMapGraphQlResponse.java:180)
If i use this guide
class HeaderInterceptor implements WebGraphQlInterceptor {
@Override
public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) {
String value = request.getHeaders().getFirst("myHeader");
request.configureExecutionInput((executionInput, builder) ->
builder.graphQLContext(Collections.singletonMap("myHeader", value)).build());
return chain.next(request);
}
}
and then throw GraphQLError with custom type
public class CustomExceptionResolver extends DataFetcherExceptionResolverAdapter
My type:
public enum CustomErrorType implements ErrorClassification {
ENTITY_NOT_FOUND("EntityNotFound"),
ACCESS_DENIED("AccessDenied");
private final String errorClassification;
CustomErrorType(String errorClassification) {
this.errorClassification = errorClassification;
}
@Override
public String toString() {
return errorClassification;
}
}
I'm getting this exception :(