fix(tui): show bootstrap errors instead of {} to trace (#4779)

Co-authored-by: Github Action <action@github.com>
This commit is contained in:
Jensen
2025-11-27 00:49:55 +08:00
committed by GitHub
parent 8963b536ee
commit 33f004d4b6
3 changed files with 26 additions and 3 deletions

View File

@@ -38,3 +38,18 @@ export function FormatError(input: unknown) {
if (UI.CancelledError.isInstance(input)) return ""
}
export function FormatUnknownError(input: unknown): string {
if (input instanceof Error) {
return input.stack ?? `${input.name}: ${input.message}`
}
if (typeof input === "object" && input !== null) {
try {
const json = JSON.stringify(input, null, 2)
if (json && json !== "{}") return json
} catch {}
}
return String(input)
}