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

graphql-java 21.1 #1927

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<version.jakarta.servlet>6.0.0</version.jakarta.servlet>
<version.jakarta.websocket>2.0.0</version.jakarta.websocket>
<version.graphql-java-federation>2.1.1</version.graphql-java-federation>
<version.graphql-java>20.2</version.graphql-java>
<version.graphql-java>21.1</version.graphql-java>
<verison.io.micrometer>1.11.3</verison.io.micrometer>
<version.vertx>4.4.1</version.vertx>
<version.smallrye-opentelemetry>2.4.0</version.smallrye-opentelemetry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ public List<GraphQLError> toGraphQLErrors(DataFetchingEnvironment dfe, Throwable
.exception(t)
.build();

DataFetcherExceptionHandlerResult exceptionHandlerResult = exceptionHandler.onException(handlerParameters);
DataFetcherExceptionHandlerResult exceptionHandlerResult = null;
try {
exceptionHandlerResult = exceptionHandler.handleException(handlerParameters).get();
} catch (Exception e) {
// this should generally not happen - exceptionHandler.handleException doesn't do any IO and doesn't
// throw exceptions, so maybe only if we get interrupted at the right moment
throw new RuntimeException(e);
}

return exceptionHandlerResult.getErrors();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static io.smallrye.graphql.SmallRyeGraphQLServerLogging.log;

import java.util.concurrent.CompletableFuture;

import graphql.ExceptionWhileDataFetching;
import graphql.execution.DataFetcherExceptionHandler;
import graphql.execution.DataFetcherExceptionHandlerParameters;
Expand All @@ -20,7 +22,8 @@ public class ExceptionHandler implements DataFetcherExceptionHandler {
private final Config config = Config.get();

@Override
public DataFetcherExceptionHandlerResult onException(DataFetcherExceptionHandlerParameters handlerParameters) {
public CompletableFuture<DataFetcherExceptionHandlerResult> handleException(
DataFetcherExceptionHandlerParameters handlerParameters) {
Throwable throwable = handlerParameters.getException();
throwable = unwrapThrowable(throwable);
SourceLocation sourceLocation = handlerParameters.getSourceLocation();
Expand All @@ -30,7 +33,8 @@ public DataFetcherExceptionHandlerResult onException(DataFetcherExceptionHandler
log.dataFetchingError(throwable);
}

return DataFetcherExceptionHandlerResult.newResult().error(error).build();
// we don't do any IO in this method, so we can just synchronously compute the result and return after that
return CompletableFuture.completedFuture(DataFetcherExceptionHandlerResult.newResult().error(error).build());
}

private ExceptionWhileDataFetching getExceptionWhileDataFetching(Throwable throwable, SourceLocation sourceLocation,
Expand Down
Loading