@@ -1091,7 +1091,6 @@ async function completeAsyncIteratorValue(
10911091 completeListItemValue (
10921092 iteration . value ,
10931093 completedResults ,
1094- errors ,
10951094 exeContext ,
10961095 itemType ,
10971096 fieldNodes ,
@@ -1121,7 +1120,6 @@ function completeListValue(
11211120 asyncPayloadRecord ?: AsyncPayloadRecord ,
11221121) : PromiseOrValue < ReadonlyArray < unknown > > {
11231122 const itemType = returnType . ofType ;
1124- const errors = asyncPayloadRecord ?. errors ?? exeContext . errors ;
11251123
11261124 if ( isAsyncIterable ( result ) ) {
11271125 const iterator = result [ Symbol . asyncIterator ] ( ) ;
@@ -1180,7 +1178,6 @@ function completeListValue(
11801178 completeListItemValue (
11811179 item ,
11821180 completedResults ,
1183- errors ,
11841181 exeContext ,
11851182 itemType ,
11861183 fieldNodes ,
@@ -1206,68 +1203,41 @@ function completeListValue(
12061203function completeListItemValue (
12071204 item : unknown ,
12081205 completedResults : Array < unknown > ,
1209- errors : Array < GraphQLError > ,
12101206 exeContext : ExecutionContext ,
12111207 itemType : GraphQLOutputType ,
12121208 fieldNodes : ReadonlyArray < FieldNode > ,
12131209 info : GraphQLResolveInfo ,
12141210 itemPath : Path ,
12151211 asyncPayloadRecord ?: AsyncPayloadRecord ,
12161212) : boolean {
1217- try {
1218- let completedItem ;
1219- if ( isPromise ( item ) ) {
1220- completedItem = item . then ( ( resolved ) =>
1221- completeValue (
1222- exeContext ,
1223- itemType ,
1224- fieldNodes ,
1225- info ,
1226- itemPath ,
1227- resolved ,
1228- asyncPayloadRecord ,
1229- ) ,
1230- ) ;
1231- } else {
1232- completedItem = completeValue (
1213+ if ( isPromise ( item ) ) {
1214+ completedResults . push (
1215+ completePromiseCatchingErrors (
12331216 exeContext ,
12341217 itemType ,
12351218 fieldNodes ,
12361219 info ,
12371220 itemPath ,
12381221 item ,
12391222 asyncPayloadRecord ,
1240- ) ;
1241- }
1242-
1243- if ( isPromise ( completedItem ) ) {
1244- // Note: we don't rely on a `catch` method, but we do expect "thenable"
1245- // to take a second callback for the error case.
1246- completedResults . push (
1247- completedItem . then ( undefined , ( rawError ) => {
1248- const error = locatedError (
1249- rawError ,
1250- fieldNodes ,
1251- pathToArray ( itemPath ) ,
1252- ) ;
1253- const handledError = handleFieldError ( error , itemType , errors ) ;
1254- filterSubsequentPayloads ( exeContext , itemPath , asyncPayloadRecord ) ;
1255- return handledError ;
1256- } ) ,
1257- ) ;
1223+ ) ,
1224+ ) ;
1225+ return true ;
1226+ }
12581227
1259- return true ;
1260- }
1228+ const completed = completeValueCatchingErrors (
1229+ exeContext ,
1230+ itemType ,
1231+ fieldNodes ,
1232+ info ,
1233+ itemPath ,
1234+ item ,
1235+ asyncPayloadRecord ,
1236+ ) ;
12611237
1262- completedResults . push ( completedItem ) ;
1263- } catch ( rawError ) {
1264- const error = locatedError ( rawError , fieldNodes , pathToArray ( itemPath ) ) ;
1265- const handledError = handleFieldError ( error , itemType , errors ) ;
1266- filterSubsequentPayloads ( exeContext , itemPath , asyncPayloadRecord ) ;
1267- completedResults . push ( handledError ) ;
1268- }
1238+ completedResults . push ( completed ) ;
12691239
1270- return false ;
1240+ return isPromise ( completed ) ;
12711241}
12721242
12731243/**
0 commit comments