File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ import type { PromiseOrValue } from '../../jsutils/PromiseOrValue.js';
8
8
import { parse } from '../../language/parser.js' ;
9
9
10
10
import type { GraphQLFieldResolver } from '../../type/definition.js' ;
11
- import { GraphQLList , GraphQLObjectType } from '../../type/definition.js' ;
11
+ import {
12
+ GraphQLList ,
13
+ GraphQLNonNull ,
14
+ GraphQLObjectType ,
15
+ } from '../../type/definition.js' ;
12
16
import { GraphQLString } from '../../type/scalars.js' ;
13
17
import { GraphQLSchema } from '../../type/schema.js' ;
14
18
@@ -101,7 +105,7 @@ describe('Execute: Accepts async iterables as list value', () => {
101
105
name : 'ObjectWrapper' ,
102
106
fields : {
103
107
index : {
104
- type : GraphQLString ,
108
+ type : new GraphQLNonNull ( GraphQLString ) ,
105
109
resolve,
106
110
} ,
107
111
} ,
@@ -202,7 +206,7 @@ describe('Execute: Accepts async iterables as list value', () => {
202
206
return Promise . resolve ( index ) ;
203
207
} ) ,
204
208
) . toDeepEqual ( {
205
- data : { listField : [ { index : '0' } , { index : '1' } , { index : null } ] } ,
209
+ data : { listField : [ { index : '0' } , { index : '1' } , null ] } ,
206
210
errors : [
207
211
{
208
212
message : 'bad' ,
Original file line number Diff line number Diff line change @@ -1017,8 +1017,22 @@ async function completeAsyncIteratorValue(
1017
1017
) ;
1018
1018
if ( isPromise ( completedItem ) ) {
1019
1019
containsPromise = true ;
1020
+ // Note: we don't rely on a `catch` method, but we do expect "thenable"
1021
+ // to take a second callback for the error case.
1022
+ completedResults . push (
1023
+ completedItem . then ( undefined , ( rawError ) => {
1024
+ const error = locatedError (
1025
+ rawError ,
1026
+ fieldNodes ,
1027
+ pathToArray ( fieldPath ) ,
1028
+ ) ;
1029
+ const handledError = handleFieldError ( error , itemType , errors ) ;
1030
+ return handledError ;
1031
+ } ) ,
1032
+ ) ;
1033
+ } else {
1034
+ completedResults . push ( completedItem ) ;
1020
1035
}
1021
- completedResults . push ( completedItem ) ;
1022
1036
} catch ( rawError ) {
1023
1037
completedResults . push ( null ) ;
1024
1038
const error = locatedError (
You can’t perform that action at this time.
0 commit comments