You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 :(
The text was updated successfully, but these errors were encountered:
We can't deserialize to a custom enum type on the client side, but we can use ErrorClassification#errorClassification, so at least it returns something and doesn't fail.
rstoyanchev
changed the title
Exception ResponseMapGraphQlResponse:getErrorType
Avoid IllegalArgumentException for custom error type in ResponseMapGraphQlResponse
Feb 12, 2025
Uh oh!
There was an error while loading. Please reload this page.
I can not use there own ErrorClassification
If i use this guide
and then throw GraphQLError with custom type
public class CustomExceptionResolver extends DataFetcherExceptionResolverAdapter
My type:
I'm getting this exception :(
The text was updated successfully, but these errors were encountered: