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