From 67c8e39d833e09eebecfbc24729927a2576ce029 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Mon, 22 Apr 2024 01:35:58 +0900 Subject: [PATCH] Fix alertError function to handle non-string messages --- src/ts/alert.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ts/alert.ts b/src/ts/alert.ts index 123e60e6..29036e8c 100644 --- a/src/ts/alert.ts +++ b/src/ts/alert.ts @@ -26,6 +26,14 @@ export function alertError(msg:string){ console.error(msg) const db = get(DataBase) + if(typeof(msg) !== 'string'){ + try{ + msg = JSON.stringify(msg) + }catch(e){ + msg = `${msg}` + } + } + let submsg = '' //check if it's a known error