diff --git a/pom.xml b/pom.xml
index 58a360914..73e801a67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@
6.0.0
2.0.0
2.1.1
- 20.2
+ 21.1
1.11.3
4.4.1
2.4.0
diff --git a/server/implementation/src/main/java/io/smallrye/graphql/execution/datafetcher/helper/ErrorResultHelper.java b/server/implementation/src/main/java/io/smallrye/graphql/execution/datafetcher/helper/ErrorResultHelper.java
index b6bb32ce8..05dd304c6 100644
--- a/server/implementation/src/main/java/io/smallrye/graphql/execution/datafetcher/helper/ErrorResultHelper.java
+++ b/server/implementation/src/main/java/io/smallrye/graphql/execution/datafetcher/helper/ErrorResultHelper.java
@@ -51,7 +51,14 @@ public List 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();
}
diff --git a/server/implementation/src/main/java/io/smallrye/graphql/execution/error/ExceptionHandler.java b/server/implementation/src/main/java/io/smallrye/graphql/execution/error/ExceptionHandler.java
index 2e2e9ae18..85186dfc2 100644
--- a/server/implementation/src/main/java/io/smallrye/graphql/execution/error/ExceptionHandler.java
+++ b/server/implementation/src/main/java/io/smallrye/graphql/execution/error/ExceptionHandler.java
@@ -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;
@@ -20,7 +22,8 @@ public class ExceptionHandler implements DataFetcherExceptionHandler {
private final Config config = Config.get();
@Override
- public DataFetcherExceptionHandlerResult onException(DataFetcherExceptionHandlerParameters handlerParameters) {
+ public CompletableFuture handleException(
+ DataFetcherExceptionHandlerParameters handlerParameters) {
Throwable throwable = handlerParameters.getException();
throwable = unwrapThrowable(throwable);
SourceLocation sourceLocation = handlerParameters.getSourceLocation();
@@ -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,