Skip to content

Commit 7e97ea8

Browse files
Copilotfuxingloh
andcommitted
chore: document error handling fallbacks
Co-authored-by: fuxingloh <4266087+fuxingloh@users.noreply.github.com>
1 parent 220f055 commit 7e97ea8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/use-agently/src/bin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function resolveOutputFormat(): "tui" | "json" {
1212
try {
1313
return getOutputFormat(cli);
1414
} catch {
15-
// Fallback for unexpected failures before Commander parses options.
15+
// If option parsing fails, still show the underlying CLI error without double-logging here.
1616
return "tui";
1717
}
1818
}

packages/use-agently/src/errors.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe("handleCliError", () => {
99
beforeEach(() => {
1010
originalIsTTY = process.stderr.isTTY;
1111
exitSpy = spyOn(process, "exit").mockImplementation((code?: number) => {
12+
// Bubble a sentinel error so tests can assert the exit while preventing the process from terminating.
1213
throw new Error("process.exit");
1314
});
1415
errorSpy = spyOn(console, "error").mockImplementation(() => {});

0 commit comments

Comments
 (0)