From 2a3fd044499c63d58925e9f7fe865fe84134ef2c Mon Sep 17 00:00:00 2001 From: Jan Martiska Date: Thu, 5 Jan 2023 10:05:20 +0100 Subject: [PATCH] Log graphql.execution.AbortExecutionException when it occurs --- .../runtime/SmallRyeGraphQLExecutionHandler.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java index 7ff8e8d403998..127e1ed8cc759 100644 --- a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java +++ b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java @@ -13,9 +13,12 @@ import javax.json.JsonObjectBuilder; import javax.json.JsonReader; +import org.jboss.logging.Logger; + import graphql.ErrorType; import graphql.ExecutionResult; import graphql.GraphQLError; +import graphql.execution.AbortExecutionException; import io.quarkus.security.identity.CurrentIdentityAssociation; import io.quarkus.vertx.http.runtime.CurrentVertxRequest; import io.smallrye.graphql.execution.ExecutionResponse; @@ -46,6 +49,8 @@ public class SmallRyeGraphQLExecutionHandler extends SmallRyeGraphQLAbstractHand + StandardCharsets.UTF_8.name(); private static final String MISSING_OPERATION = "Missing operation body"; + private static final Logger log = Logger.getLogger(SmallRyeGraphQLExecutionHandler.class); + public SmallRyeGraphQLExecutionHandler(boolean allowGet, boolean allowPostWithQueryParameters, boolean runBlocking, CurrentIdentityAssociation currentIdentityAssociation, CurrentVertxRequest currentVertxRequest) { @@ -320,8 +325,13 @@ class VertxExecutionResponseWriter implements ExecutionResponseWriter { @Override public void write(ExecutionResponse er) { - if (shouldFail(er)) { + er.getExecutionResult() + .getErrors().stream() + .filter(e -> e.getErrorType().equals(ErrorType.ExecutionAborted)) + .forEach(e -> { + log.error("Execution aborted", (AbortExecutionException) e); + }); response.setStatusCode(500) .end(); } else {