Skip to content

Commit 1543d02

Browse files
committed
zap context.errors
1 parent fe4d4f3 commit 1543d02

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/execution/execute.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ export type ExecutionContext = {
9595
operation: OperationDefinitionNode,
9696
variableValues: { [variable: string]: mixed },
9797
fieldResolver: GraphQLFieldResolver<any, any>,
98-
errors: Array<GraphQLError>,
9998
};
10099

101100
/**
@@ -230,21 +229,17 @@ function executeImpl(
230229
// field and its descendants will be omitted, and sibling fields will still
231230
// be executed. An execution which encounters errors will still result in a
232231
// resolved Promise.
233-
const result = executeOperation(context, context.operation, rootValue);
234-
return buildResponse(context, result);
232+
const data = executeOperation(context, context.operation, rootValue);
233+
return buildResponse(data);
235234
}
236235

237236
/**
238-
* Given a completed execution context and data, build the { errors, data }
239-
* response defined by the "Response" section of the GraphQL specification.
237+
* Strip out `errors` if empty.
240238
*/
241-
function buildResponse(
242-
context: ExecutionContext,
243-
result: ExecutionPartialResult<mixed>,
244-
) {
239+
function buildResponse(result: ExecutionPartialResult<mixed>) {
245240
const promise = getPromise(result);
246241
if (promise) {
247-
return promise.then(resolved => buildResponse(context, resolved));
242+
return promise.then(resolved => buildResponse(resolved));
248243
}
249244
if (result.data && (!result.errors || !result.errors.length)) {
250245
return { data: result.data };
@@ -384,7 +379,6 @@ export function buildExecutionContext(
384379
operation,
385380
variableValues,
386381
fieldResolver: fieldResolver || defaultFieldResolver,
387-
errors,
388382
};
389383
}
390384

0 commit comments

Comments
 (0)