feat: don't rethrow same error and handle errors globally

This commit is contained in:
Dominik Pschenitschni 2021-10-09 16:04:19 +02:00
parent 6f51921588
commit 3b940cb56c
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
71 changed files with 69 additions and 451 deletions

View file

@ -96,10 +96,30 @@ app.config.errorHandler = (err, vm, info) => {
// if (import.meta.env.PROD) {
// error(err)
// } else {
console.error(err, vm, info)
// console.error(err, vm, info)
error(err)
// }
}
if (import.meta.env.DEV) {
app.config.warnHandler = (msg, vm, info) => {
error(msg)
}
}
// https://stackoverflow.com/a/52076738/15522256
window.addEventListener('error', (err) => {
error(err)
})
window.addEventListener('unhandledrejection', (err) => {
// event.promise contains the promise object
// event.reason contains the reason for the rejection
error(err)
})
app.config.globalProperties.$message = {
error,
success,