11import { after } from '../jsutils/after.js' ;
2- import { afterMaybeAsync } from '../jsutils/afterMaybeAsync.js' ;
3- import { catchAfter } from '../jsutils/catchAfter.js' ;
42import { inspect } from '../jsutils/inspect.js' ;
53import { invariant } from '../jsutils/invariant.js' ;
64import { isAsyncIterable } from '../jsutils/isAsyncIterable.js' ;
@@ -15,7 +13,6 @@ import { addPath, pathToArray } from '../jsutils/Path.js';
1513import { promiseForObject } from '../jsutils/promiseForObject.js' ;
1614import type { PromiseOrValue } from '../jsutils/PromiseOrValue.js' ;
1715import { promiseReduce } from '../jsutils/promiseReduce.js' ;
18- import { tryAfter } from '../jsutils/tryAfter.js' ;
1916
2017import type { GraphQLFormattedError } from '../error/GraphQLError.js' ;
2118import { GraphQLError } from '../error/GraphQLError.js' ;
@@ -349,7 +346,7 @@ function executeImpl(
349346 try {
350347 const result = executeOperation ( exeContext ) ;
351348 if ( isPromise ( result ) ) {
352- return tryAfter (
349+ return after (
353350 result ,
354351 ( data ) => {
355352 const initialResult = buildResponse ( data , exeContext . errors ) ;
@@ -650,7 +647,7 @@ function executeFields(
650647 }
651648 } catch ( error ) {
652649 if ( containsPromise ) {
653- return tryAfter (
650+ return after (
654651 promiseForObject ( results ) ,
655652 ( ) => {
656653 throw error ;
@@ -747,7 +744,7 @@ function executeField(
747744 ) ;
748745
749746 if ( isPromise ( completed ) ) {
750- return catchAfter ( completed , ( rawError ) => {
747+ return after ( completed , undefined , ( rawError ) => {
751748 const error = locatedError ( rawError , fieldNodes , pathToArray ( path ) ) ;
752749 const handledError = handleFieldError ( error , returnType , errors ) ;
753750 filterSubsequentPayloads ( exeContext , path , asyncPayloadRecord ) ;
@@ -1221,7 +1218,7 @@ function completeListItemValue(
12211218 // Note: we don't rely on a `catch` method, but we do expect "thenable"
12221219 // to take a second callback for the error case.
12231220 completedResults . push (
1224- catchAfter ( completedItem , ( rawError ) => {
1221+ after ( completedItem , undefined , ( rawError ) => {
12251222 const error = locatedError (
12261223 rawError ,
12271224 fieldNodes ,
@@ -1283,7 +1280,7 @@ function completeAbstractValue(
12831280 const runtimeType = resolveTypeFn ( result , contextValue , info , returnType ) ;
12841281
12851282 if ( isPromise ( runtimeType ) ) {
1286- return afterMaybeAsync ( runtimeType , ( resolvedRuntimeType ) =>
1283+ return after ( runtimeType , ( resolvedRuntimeType ) =>
12871284 completeObjectValue (
12881285 exeContext ,
12891286 ensureValidRuntimeType (
@@ -1395,7 +1392,7 @@ function completeObjectValue(
13951392 const isTypeOf = returnType . isTypeOf ( result , exeContext . contextValue , info ) ;
13961393
13971394 if ( isPromise ( isTypeOf ) ) {
1398- return afterMaybeAsync ( isTypeOf , ( resolvedIsTypeOf ) => {
1395+ return after ( isTypeOf , ( resolvedIsTypeOf ) => {
13991396 if ( ! resolvedIsTypeOf ) {
14001397 throw invalidReturnTypeError ( returnType , result , fieldNodes ) ;
14011398 }
@@ -1765,7 +1762,7 @@ function createSourceEventStreamImpl(
17651762 try {
17661763 const eventStream = executeSubscription ( exeContext ) ;
17671764 if ( isPromise ( eventStream ) ) {
1768- return catchAfter ( eventStream , ( error ) => ( { errors : [ error ] } ) ) ;
1765+ return after ( eventStream , undefined , ( error ) => ( { errors : [ error ] } ) ) ;
17691766 }
17701767
17711768 return eventStream ;
@@ -1836,7 +1833,7 @@ function executeSubscription(
18361833 const result = resolveFn ( rootValue , args , contextValue , info ) ;
18371834
18381835 if ( isPromise ( result ) ) {
1839- return tryAfter ( result , assertEventStream , ( error ) => {
1836+ return after ( result , assertEventStream , ( error ) => {
18401837 throw locatedError ( error , fieldNodes , pathToArray ( path ) ) ;
18411838 } ) ;
18421839 }
@@ -1890,7 +1887,7 @@ function executeDeferredFragment(
18901887 ) ;
18911888
18921889 if ( isPromise ( promiseOrData ) ) {
1893- promiseOrData = catchAfter ( promiseOrData , ( error ) => {
1890+ promiseOrData = after ( promiseOrData , undefined , ( error ) => {
18941891 asyncPayloadRecord . errors . push ( error ) ;
18951892 return null ;
18961893 } ) ;
@@ -1929,7 +1926,7 @@ function executeStreamField(
19291926 item ,
19301927 asyncPayloadRecord ,
19311928 ) ;
1932- const completedItems = tryAfter (
1929+ const completedItems = after (
19331930 completedItem ,
19341931 ( resolved ) => [ resolved ] ,
19351932 ( error ) => {
@@ -1972,7 +1969,7 @@ function executeStreamField(
19721969 }
19731970
19741971 if ( isPromise ( completedItem ) ) {
1975- const completedItems = tryAfter (
1972+ const completedItems = after (
19761973 completedItem ,
19771974 ( resolved ) => [ resolved ] ,
19781975 ( rawError ) => {
@@ -2041,7 +2038,7 @@ async function executeStreamIteratorItem(
20412038 ) ;
20422039
20432040 if ( isPromise ( completedItem ) ) {
2044- completedItem = catchAfter ( completedItem , ( rawError ) => {
2041+ completedItem = after ( completedItem , undefined , ( rawError ) => {
20452042 const error = locatedError ( rawError , fieldNodes , pathToArray ( itemPath ) ) ;
20462043 const handledError = handleFieldError (
20472044 error ,
@@ -2115,7 +2112,7 @@ async function executeStreamIterator(
21152112
21162113 let completedItems : PromiseOrValue < Array < unknown > | null > ;
21172114 if ( isPromise ( completedItem ) ) {
2118- completedItems = tryAfter (
2115+ completedItems = after (
21192116 completedItem ,
21202117 ( resolved ) => [ resolved ] ,
21212118 ( error ) => {
@@ -2315,7 +2312,7 @@ class DeferredFragmentRecord {
23152312 addData ( data : PromiseOrValue < ObjMap < unknown > | null > ) {
23162313 const parentData = this . parentContext ?. promise ;
23172314 if ( parentData ) {
2318- this . _resolve ?.( afterMaybeAsync ( parentData , ( ) => data ) ) ;
2315+ this . _resolve ?.( after ( parentData , ( ) => data ) ) ;
23192316 return ;
23202317 }
23212318 this . _resolve ?.( data ) ;
@@ -2369,7 +2366,7 @@ class StreamRecord {
23692366 addItems ( items : PromiseOrValue < Array < unknown > | null > ) {
23702367 const parentData = this . parentContext ?. promise ;
23712368 if ( parentData ) {
2372- this . _resolve ?.( afterMaybeAsync ( parentData , ( ) => items ) ) ;
2369+ this . _resolve ?.( after ( parentData , ( ) => items ) ) ;
23732370 return ;
23742371 }
23752372 this . _resolve ?.( items ) ;
0 commit comments