fix: error alert not showing when parameter is error type
This commit is contained in:
@@ -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}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user