From af2b38edf8c2946d524610f4df55adb5ce6ddf82 Mon Sep 17 00:00:00 2001 From: "J.T. Sage" Date: Mon, 19 Aug 2024 23:04:09 -0400 Subject: [PATCH] Add uncaught error handlers in renderer --- renderer/renderJS/util/util_lib.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/renderer/renderJS/util/util_lib.js b/renderer/renderJS/util/util_lib.js index f6dcb795..c770eced 100644 --- a/renderer/renderJS/util/util_lib.js +++ b/renderer/renderJS/util/util_lib.js @@ -528,6 +528,18 @@ function enhanceI18N() { }) } +// MARK: ERROR HANDLE +window.addEventListener('unhandledrejection', (e) => { + window.log.error('Unhandled Rejection') + window.log.warning(e?.reason?.message) + window.log.warning(e?.reason?.stack) +}) +window.addEventListener('error', (e) => { + window.log.error('Uncaught Error') + window.log.warning(e?.error?.message) + window.log.warning(e?.error?.stack) +}) + // MARK: PAGE LOAD window.addEventListener('DOMContentLoaded', () => { enhanceI18N()