From 0d2af658acc4c60bc16b058f386def19b01ba96b Mon Sep 17 00:00:00 2001 From: NI Date: Mon, 9 Sep 2019 22:15:36 +0800 Subject: [PATCH] Add error handlers to catch uncaugth errors --- ui/app.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/app.js b/ui/app.js index b103f56..e61c3db 100644 --- a/ui/app.js +++ b/ui/app.js @@ -284,6 +284,18 @@ function initializeClient() { return; } + if (process.env.NODE_ENV === "development") { + console.log("Currently in Development environment"); + + window.addEventListener("unhandledrejection", function(e) { + console.error("Error:", e); + }); + + window.addEventListener("error", function(e) { + console.error("Error:", e); + }); + } + landingRoot.parentNode.removeChild(landingRoot); let normalRoot = document.createElement("div");