From 573893088ba84beea97f90bb782caa29afb4b5a6 Mon Sep 17 00:00:00 2001 From: Bretton <36870434+BrettM86@users.noreply.github.com> Date: Thu, 16 Jul 2026 01:56:13 -0700 Subject: [PATCH] fix(error): always return a string from errorMessage The fallback branch returned the raw error value, and non-string values crashed the toast's markdown renderer (src.replaceAll is not a function), turning real failures into empty toasts. Co-Authored-By: Claude Fable 5 --- src/lib/app/error.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/app/error.ts b/src/lib/app/error.ts index e19d893d..fef23eeb 100644 --- a/src/lib/app/error.ts +++ b/src/lib/app/error.ts @@ -33,6 +33,14 @@ export function errorMessage(error: any, instance?: string): string { const translated = t.get(key) return translated === key ? String(error) : translated } catch { - return error as any + // Consumers render this (e.g. inside toast markdown), so it must always + // be a string — a raw object here crashes the toast into an empty box. + if (typeof error === 'string') return error + if (error instanceof Error) return error.message + try { + return JSON.stringify(error) ?? String(error) + } catch { + return String(error) + } } } -- 2.51.2