Skip to content

Commit a68f39c

Browse files
committed
fix exception chaining
1 parent 2bfd809 commit a68f39c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/graphql/execution/ExecutionStrategy.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,9 @@ private Object fetchField(GraphQLFieldDefinition fieldDef, ExecutionContext exec
496496
.handle((result, exception) -> executionContext.call(exception, () -> {
497497
fetchCtx.onCompleted(result, exception);
498498
if (exception != null) {
499-
CompletableFuture<Object> handleFetchingExceptionResult = handleFetchingException(dataFetchingEnvironment.get(), parameters, exception);
499+
// because we added an artificial CF, we need to unwrap the exception
500+
Throwable cause = exception.getCause();
501+
CompletableFuture<Object> handleFetchingExceptionResult = handleFetchingException(dataFetchingEnvironment.get(), parameters, cause);
500502
return handleFetchingExceptionResult;
501503
} else {
502504
// we can simply return the fetched value CF and avoid a allocation

0 commit comments

Comments
 (0)