fix: error alert not showing when parameter is error type

This commit is contained in:
Kim, Harim
2025-05-19 21:02:20 +09:00
parent 57568ed7bc
commit ec7ffa0314

View File

@@ -26,14 +26,18 @@ export const alertStore = {
} }
} }
export function alertError(msg:string){ export function alertError(msg: string | Error) {
console.error(msg) console.error(msg)
const db = getDatabase() const db = getDatabase()
if(typeof(msg) !== 'string'){ if (typeof(msg) !== 'string') {
try{ try{
msg = JSON.stringify(msg) if (msg instanceof Error) {
}catch(e){ msg = msg.message
} else {
msg = JSON.stringify(msg)
}
} catch {
msg = `${msg}` msg = `${msg}`
} }
} }