From ec7ffa03141b7c548a22c52689727ca6f6f56527 Mon Sep 17 00:00:00 2001 From: "Kim, Harim" Date: Mon, 19 May 2025 21:02:20 +0900 Subject: [PATCH] fix: error alert not showing when parameter is error type --- src/ts/alert.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ts/alert.ts b/src/ts/alert.ts index 746f6797..a2042c37 100644 --- a/src/ts/alert.ts +++ b/src/ts/alert.ts @@ -26,14 +26,18 @@ export const alertStore = { } } -export function alertError(msg:string){ +export function alertError(msg: string | Error) { console.error(msg) const db = getDatabase() - if(typeof(msg) !== 'string'){ + if (typeof(msg) !== 'string') { try{ - msg = JSON.stringify(msg) - }catch(e){ + if (msg instanceof Error) { + msg = msg.message + } else { + msg = JSON.stringify(msg) + } + } catch { msg = `${msg}` } }