From 56279e37941b371df2906a07f55281dcc70207c5 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Wed, 17 May 2023 20:05:37 -0500 Subject: [PATCH] Fix thrown errors not appearing in console --- src/main.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 9fb753b..e416fa5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -32,14 +32,16 @@ console.error = function (...args) { error(...args); }; -window.onerror = function (event, source, lineno, colno, error) { - state.errors.push(error instanceof Error ? error : new Error(JSON.stringify(error))); +window.onerror = function (event, source, lineno, colno, err) { + state.errors.push(err instanceof Error ? err : new Error(JSON.stringify(err))); + error(err); return true; }; window.onunhandledrejection = function (event) { state.errors.push( event.reason instanceof Error ? event.reason : new Error(JSON.stringify(event.reason)) ); + error(event.reason); }; document.title = projInfo.title;