Skip to content

Commit 4b188d0

Browse files
committed
Don't swallow errors.
1 parent 861edce commit 4b188d0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/functions/src/service.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,9 @@ async function streamAtURL(
474474

475475
const processLine = (line: string | undefined): { done: boolean, value: unknown } | null => {
476476
// ignore all other lines (newline, comments, etc.)
477-
if (!line?.startsWith('data: ')) { return null; }
477+
if (!line?.startsWith('data: ')) {
478+
return null;
479+
}
478480

479481
try {
480482
const jsonData = JSON.parse(line.slice(6));
@@ -492,6 +494,10 @@ async function streamAtURL(
492494
}
493495
return null; // Unrecognize keys. Skip this line.
494496
} catch (error) {
497+
if (error instanceof FunctionsError) {
498+
throw error;
499+
}
500+
// ignore other parsing error
495501
return null;
496502
}
497503
};

0 commit comments

Comments
 (0)