Skip to content

Commit c4e2420

Browse files
committed
zap context.errors
1 parent 9f9b4a0 commit c4e2420

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/execution/execute.js

+5-11
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ export type ExecutionContext = {
9494
operation: OperationDefinitionNode,
9595
variableValues: { [variable: string]: mixed },
9696
fieldResolver: GraphQLFieldResolver<any, any>,
97-
errors: Array<GraphQLError>,
9897
};
9998

10099
/**
@@ -235,21 +234,17 @@ function executeImpl(
235234
// field and its descendants will be omitted, and sibling fields will still
236235
// be executed. An execution which encounters errors will still result in a
237236
// resolved Promise.
238-
const result = executeOperation(context, context.operation, rootValue);
239-
return buildResponse(context, result);
237+
const data = executeOperation(context, context.operation, rootValue);
238+
return buildResponse(data);
240239
}
241240

242241
/**
243-
* Given a completed execution context and data, build the { errors, data }
244-
* response defined by the "Response" section of the GraphQL specification.
242+
* Strip out `errors` if empty.
245243
*/
246-
function buildResponse(
247-
context: ExecutionContext,
248-
result: ExecutionPartialResult<mixed>,
249-
) {
244+
function buildResponse(result: ExecutionPartialResult<mixed>) {
250245
const promise = getPromise(result);
251246
if (promise) {
252-
return promise.then(resolved => buildResponse(context, resolved));
247+
return promise.then(resolved => buildResponse(resolved));
253248
}
254249
if (result.data && (!result.errors || !result.errors.length)) {
255250
return { data: result.data };
@@ -389,7 +384,6 @@ export function buildExecutionContext(
389384
operation,
390385
variableValues,
391386
fieldResolver: fieldResolver || defaultFieldResolver,
392-
errors,
393387
};
394388
}
395389

0 commit comments

Comments
 (0)