Skip to content

Commit 419fd37

Browse files
committed
refactor: move executeStreamField out of try
this function should catches errors and should never throw
1 parent bd5aae7 commit 419fd37

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

src/execution/execute.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,28 +1103,29 @@ function completeListValue(
11031103
// No need to modify the info object containing the path,
11041104
// since from here on it is not ever accessed by resolver functions.
11051105
const itemPath = addPath(path, index, undefined);
1106+
1107+
if (
1108+
stream &&
1109+
typeof stream.initialCount === 'number' &&
1110+
index >= stream.initialCount
1111+
) {
1112+
previousAsyncPayloadRecord = executeStreamField(
1113+
path,
1114+
itemPath,
1115+
item,
1116+
exeContext,
1117+
fieldNodes,
1118+
info,
1119+
itemType,
1120+
stream.label,
1121+
previousAsyncPayloadRecord,
1122+
);
1123+
index++;
1124+
continue;
1125+
}
1126+
11061127
try {
11071128
let completedItem;
1108-
1109-
if (
1110-
stream &&
1111-
typeof stream.initialCount === 'number' &&
1112-
index >= stream.initialCount
1113-
) {
1114-
previousAsyncPayloadRecord = executeStreamField(
1115-
path,
1116-
itemPath,
1117-
item,
1118-
exeContext,
1119-
fieldNodes,
1120-
info,
1121-
itemType,
1122-
stream.label,
1123-
previousAsyncPayloadRecord,
1124-
);
1125-
index++;
1126-
continue;
1127-
}
11281129
if (isPromise(item)) {
11291130
completedItem = item.then((resolved) =>
11301131
completeValue(

0 commit comments

Comments
 (0)