refactor: dedupe core helper error formatting

This commit is contained in:
Peter Steinberger
2026-04-07 01:11:40 +01:00
parent 325ff24bae
commit 8a40cd7ed4
6 changed files with 12 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
import type { Command } from "commander";
import { formatErrorMessage } from "../../infra/errors.js";
import { formatTimeAgo } from "../../infra/format-time/format-relative.ts";
import { defaultRuntime } from "../../runtime.js";
import { getTerminalTableWidth, renderTable } from "../../terminal/table.js";
@@ -99,7 +100,7 @@ function parseSinceMs(raw: unknown, label: string): number | undefined {
try {
return parseDurationMs(value);
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
const message = formatErrorMessage(err);
defaultRuntime.error(`${label}: ${message}`);
defaultRuntime.exit(1);
return undefined;