From a0296d606deaf297bd0042170f9034009170309a Mon Sep 17 00:00:00 2001 From: "Hung-Han (Henry) Chen" Date: Mon, 12 Jul 2021 14:39:35 +0300 Subject: [PATCH] Remove try...catch block Signed-off-by: Hung-Han (Henry) Chen --- src/common/sentry.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/common/sentry.ts b/src/common/sentry.ts index 50cf847673..da0e749994 100644 --- a/src/common/sentry.ts +++ b/src/common/sentry.ts @@ -45,13 +45,7 @@ export function SentryInit() { Sentry.init({ beforeSend: (event) => { // default to false, in case instance of UserStore is not created (yet) - let allowErrorReporting = false; - - try { - allowErrorReporting = UserStore.getInstance()?.allowErrorReporting; - } catch { - // ignore the TypeError throw by UserStore.getInstance() - } + const allowErrorReporting = UserStore.getInstance(false)?.allowErrorReporting ?? false; if (allowErrorReporting) { return event;