X Tutup
Skip to content
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
26 changes: 7 additions & 19 deletions src/main/java/graphql/execution/ExecutionStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,10 @@ protected CompletableFuture<FetchedValue> fetchField(ExecutionContext executionC
.handle((result, exception) -> {
fetchCtx.onCompleted(result, exception);
if (exception != null) {
return handleFetchingException(executionContext, dataFetchingEnvironment.get(), exception);
return handleFetchingException(dataFetchingEnvironment.get(), exception);
} else {
return CompletableFuture.completedFuture(result);
// we can simply return the fetched value CF and avoid a allocation
return fetchedValue;
}
})
.thenCompose(Function.identity())
Expand Down Expand Up @@ -331,7 +332,7 @@ protected FetchedValue unboxPossibleDataFetcherResult(ExecutionContext execution
if (result instanceof DataFetcherResult) {
DataFetcherResult<?> dataFetcherResult = (DataFetcherResult<?>) result;
executionContext.addErrors(dataFetcherResult.getErrors());
addExtensionsIfPresent(executionContext,dataFetcherResult);
addExtensionsIfPresent(executionContext, dataFetcherResult);

Object localContext = dataFetcherResult.getLocalContext();
if (localContext == null) {
Expand Down Expand Up @@ -363,9 +364,9 @@ private void addExtensionsIfPresent(ExecutionContext executionContext, DataFetch
}
}

protected <T> CompletableFuture<T> handleFetchingException(ExecutionContext executionContext,
DataFetchingEnvironment environment,
Throwable e) {
protected <T> CompletableFuture<T> handleFetchingException(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never used

DataFetchingEnvironment environment,
Throwable e) {
DataFetcherExceptionHandlerParameters handlerParameters = DataFetcherExceptionHandlerParameters.newExceptionParameters()
.dataFetchingEnvironment(environment)
.exception(e)
Expand Down Expand Up @@ -714,19 +715,6 @@ private Object handleCoercionProblem(ExecutionContext context, ExecutionStrategy
return null;
}

/**
* Converts an object that is known to should be an Iterable into one
*
* @param result the result object
*
* @return an Iterable from that object
*
* @throws java.lang.ClassCastException if it's not an Iterable
*/
protected Iterable<Object> toIterable(Object result) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never used

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically a breaking change BUT a low risk one

return FpKit.toIterable(result);
}

protected GraphQLObjectType resolveType(ExecutionContext executionContext, ExecutionStrategyParameters parameters, GraphQLType fieldType) {
// we can avoid a method call and type resolver environment allocation if we know it's an object type
if (fieldType instanceof GraphQLObjectType) {
Expand Down
X Tutup