Skip to content

Commit

Permalink
Gateway: pass through errors encountered when running final execute (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
princed authored Jun 4, 2021
1 parent 4e4bb33 commit 9045f55
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gateway-js/src/executeQueryPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export async function executeQueryPlan<TContext>(
// the original query.
// It is also used to allow execution of introspection queries though.
try {
({ data } = await execute({
const executionResult = await execute({
schema: operationContext.schema,
document: {
kind: Kind.DOCUMENT,
Expand All @@ -94,7 +94,11 @@ export async function executeQueryPlan<TContext>(
variableValues: requestContext.request.variables,
// See also `wrapSchemaWithAliasResolver` in `gateway-js/src/index.ts`.
fieldResolver: defaultFieldResolverWithAliasSupport,
}));
});
data = executionResult.data;
if (executionResult.errors?.length) {
errors.push(...executionResult.errors)
}
} catch (error) {
return { errors: [error] };
}
Expand Down

0 comments on commit 9045f55

Please sign in to comment.