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

Log graphql.execution.AbortExecutionException when it occurs #30195

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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