Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

GraphQLErrorFromExceptionHandler doesn`t work for AbortExecutionException #612

Closed
Thinkenterprise opened this issue May 7, 2021 · 4 comments
Labels
Milestone

Comments

@Thinkenterprise
Copy link

I use the DDOS Feature Query Depth and configured a query depth of 3 maxQueryDepth: 3. If the query depth is larger than 3 an AbortExecutionException will be thrown. Thats ok!! But the processing of the AbortExecutionException leads to an incorrect output -> A JSON rendering problem. The problem seems to be in the following method:

class GraphQLErrorFromExceptionHandler extends DefaultGraphQLErrorHandler {

  @Override
  protected List<GraphQLError> filterGraphQLErrors(List<GraphQLError> errors) {
    return errors.stream().map(this::transform).flatMap(Collection::stream)
        .collect(Collectors.toList());
  }

After this method is called the debugging session stops on @SneakyThrows in GraphQLObjectMapper.

 @SneakyThrows
  public String serializeResultAsJson(ExecutionResult executionResult) {
    return getJacksonMapper()
        .writeValueAsString(createResultFromExecutionResult(executionResult));
  }

If I disable the use of GraphQLErrorFromExceptionHandler it works!! - For disableing I have to set the property exception-handlers-enabled: false and no use of @ExceptionHandler annotations in my resolvers.

@oliemansm
Copy link
Member

@Thinkenterprise There's no stack trace or anything being logged in this case? Also not when you set the log level to DEBUG?

@Thinkenterprise
Copy link
Author

Thinkenterprise commented May 8, 2021

@oliemansm stacktrace-and-debug.txt

@oliemansm oliemansm added this to the 11.1.0 milestone May 10, 2021
@oliemansm
Copy link
Member

@Thinkenterprise I was wrecking my brain how on earth this stack trace could happen seeing the code. But it appears the cause of this bug is already fixed on master and will therefore be available in release 11.1.0 that will be released shortly.

See also commit: 3ae07c5.

@Thinkenterprise
Copy link
Author

@oliemansm Thank you for the effort your time and the quick fix!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants