@@ -94,7 +94,6 @@ export type ExecutionContext = {
94
94
operation : OperationDefinitionNode ,
95
95
variableValues : { [ variable : string ] : mixed } ,
96
96
fieldResolver : GraphQLFieldResolver < any , any> ,
97
- errors : Array < GraphQLError > ,
98
97
} ;
99
98
100
99
/**
@@ -235,21 +234,17 @@ function executeImpl(
235
234
// field and its descendants will be omitted, and sibling fields will still
236
235
// be executed. An execution which encounters errors will still result in a
237
236
// 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 );
240
239
}
241
240
242
241
/**
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.
245
243
*/
246
- function buildResponse (
247
- context : ExecutionContext ,
248
- result : ExecutionPartialResult < mixed > ,
249
- ) {
244
+ function buildResponse ( result : ExecutionPartialResult < mixed > ) {
250
245
const promise = getPromise ( result ) ;
251
246
if ( promise ) {
252
- return promise . then ( resolved => buildResponse ( context , resolved ) ) ;
247
+ return promise . then ( resolved => buildResponse ( resolved ) ) ;
253
248
}
254
249
if ( result . data && ( ! result . errors || ! result . errors . length ) ) {
255
250
return { data : result . data } ;
@@ -389,7 +384,6 @@ export function buildExecutionContext(
389
384
operation ,
390
385
variableValues ,
391
386
fieldResolver : fieldResolver || defaultFieldResolver ,
392
- errors ,
393
387
} ;
394
388
}
395
389
0 commit comments