@@ -261,32 +261,32 @@ function executeSubscription(
261
261
// Call the `subscribe()` resolver or the default resolver to produce an
262
262
// AsyncIterable yielding raw payloads.
263
263
const resolveFn = fieldDef . subscribe ?? exeContext . subscribeFieldResolver ;
264
- const eventStream = resolveFn ( rootValue , args , contextValue , info ) ;
264
+ const result = resolveFn ( rootValue , args , contextValue , info ) ;
265
265
266
- if ( isPromise ( eventStream ) ) {
267
- return eventStream . then ( assertEventStream ) . then ( undefined , ( error ) => {
266
+ if ( isPromise ( result ) ) {
267
+ return result . then ( assertEventStream ) . then ( undefined , ( error ) => {
268
268
throw locatedError ( error , fieldNodes , pathToArray ( path ) ) ;
269
269
} ) ;
270
270
}
271
271
272
- return assertEventStream ( eventStream ) ;
272
+ return assertEventStream ( result ) ;
273
273
} catch ( error ) {
274
274
throw locatedError ( error , fieldNodes , pathToArray ( path ) ) ;
275
275
}
276
276
}
277
277
278
- function assertEventStream ( eventStream : unknown ) : AsyncIterable < unknown > {
279
- if ( eventStream instanceof Error ) {
280
- throw eventStream ;
278
+ function assertEventStream ( result : unknown ) : AsyncIterable < unknown > {
279
+ if ( result instanceof Error ) {
280
+ throw result ;
281
281
}
282
282
283
283
// Assert field returned an event stream, otherwise yield an error.
284
- if ( ! isAsyncIterable ( eventStream ) ) {
284
+ if ( ! isAsyncIterable ( result ) ) {
285
285
throw new GraphQLError (
286
286
'Subscription field must return Async Iterable. ' +
287
- `Received: ${ inspect ( eventStream ) } .` ,
287
+ `Received: ${ inspect ( result ) } .` ,
288
288
) ;
289
289
}
290
290
291
- return eventStream ;
291
+ return result ;
292
292
}
0 commit comments