From a70b92253a53407a26f5673af8f9edb5b6be80a3 Mon Sep 17 00:00:00 2001 From: dpschen Date: Sun, 17 Oct 2021 21:32:21 +0000 Subject: [PATCH] feat: throw errors (#867) Co-authored-by: Dominik Pschenitschni Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/867 Co-authored-by: dpschen Co-committed-by: dpschen --- src/main.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main.ts b/src/main.ts index 863f564a..dba5ebb8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -106,21 +106,22 @@ 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) + throw err + }) + + + window.addEventListener('unhandledrejection', (err) => { + // event.promise contains the promise object + // event.reason contains the reason for the rejection + error(err) + throw err + }) } - -// 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,