Files
tkmind_go/ui/text/src/utils.tsx
T
2026-04-14 14:17:01 +00:00

21 lines
454 B
TypeScript

export function isErrorStatus(status: string): boolean {
return status.startsWith("error") || status.startsWith("failed");
}
export function formatError(e: unknown): string {
if (e instanceof Error) {
return e.message || e.toString();
}
if (typeof e === "string") {
return e;
}
if (e && typeof e === "object") {
try {
return JSON.stringify(e, null, 2);
} catch {
return String(e);
}
}
return String(e);
}