From 85df359c0a3ec0f790ee320e2d70d04b91dbe9e5 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 5 Dec 2024 15:01:47 +0100 Subject: [PATCH] improve handling of unexpected toast errors --- frontend/src/lib/components/toast.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/toast.ts b/frontend/src/lib/components/toast.ts index f1f1a84f19..7290df87e5 100644 --- a/frontend/src/lib/components/toast.ts +++ b/frontend/src/lib/components/toast.ts @@ -2,7 +2,11 @@ const pathRegex = /\b(u|f)\/[^\/\s]+\/[^\/\s]+\b/g export function processMessage(message: string | undefined): string { - return (message ?? 'Error without message').replaceAll(pathRegex, (path) => { + return ( + typeof message == 'string' + ? message ?? 'Error without message' + : JSON.stringify(message, null, 2) + ).replaceAll(pathRegex, (path) => { return `${path}` }) }