Skip to content

Commit

Permalink
Log graphql.execution.AbortExecutionException when it occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartisk committed Jan 5, 2023
1 parent 8bfeb9d commit 2a3fd04
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2a3fd04

Please sign in to comment.