Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQLServletListener.RequestCallback.onError not being called even though an exception throws #451

Closed
muhdalavu opened this issue Jun 23, 2022 · 2 comments
Labels

Comments

@muhdalavu
Copy link

Describe the bug
I should be able to handle the Exception from the GraphQLServletListener

To Reproduce
Steps to reproduce the behavior:
In Asynchronus Excecution, Even there are exception in the response, the onError callback not being called.

Expected behavior
OnError mothod should be called
[In the below code the exceptionlly method not being called.]
file

private CompletableFuture<Void> handle(
      FutureExecutionResult futureResult,
      HttpServletRequest request,
      HttpServletResponse response,
      ListenerHandler listenerHandler) {
    return futureResult
        .thenApplyQueryResult()
        .thenAccept(
            it -> {
              listenerHandler.beforeFlush();
              writeResultResponse(futureResult.getInvocationInput(), it, request, response);
            })
        .thenAccept(it -> listenerHandler.onSuccess())
        .exceptionally(
            t ->
                writeErrorResponse(
                    futureResult.getInvocationInput(), request, response, listenerHandler, t))
        .thenAccept(it -> listenerHandler.onFinally());
  }

Screenshot 2022-06-23 at 7 24 41 PM

@muhdalavu muhdalavu added the bug label Jun 23, 2022
@oliemansm
Copy link
Member

Do you have an example project or even better a unit test in a fork of this project reproducing this issue?

@federicorispo
Copy link
Member

federicorispo commented Jun 16, 2023

I think we can close this bug since the code is changed and now the handle method calls the listenerHandler.onError when an exception is catched.

See: https://github.com/graphql-java-kickstart/graphql-java-servlet/pull/442/files#diff-a166ddb02fc54c24bbd3a3759107eebb065981ac3824adf877c1e134afd1a3ccR107-R118

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

No branches or pull requests

3 participants