From a4697e6c6c98d12061681921b7262ca432c1db96 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 13 Dec 2021 14:46:59 +0100 Subject: [PATCH] Make Notification/Handler.ts compatible with useUnknownInCatchVariables --- ts/WoltLabSuite/Core/Notification/Handler.ts | 6 ++++-- .../files/js/WoltLabSuite/Core/Notification/Handler.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ts/WoltLabSuite/Core/Notification/Handler.ts b/ts/WoltLabSuite/Core/Notification/Handler.ts index 9befaf7487..04a5ad6f1b 100644 --- a/ts/WoltLabSuite/Core/Notification/Handler.ts +++ b/ts/WoltLabSuite/Core/Notification/Handler.ts @@ -234,8 +234,10 @@ class NotificationHandler { } catch (e) { // The `Notification` constructor is not available on Android. // See https://bugs.chromium.org/p/chromium/issues/detail?id=481856 - if (e.name === "TypeError") { - return; + if (e instanceof Error) { + if (e.name === "TypeError") { + return; + } } throw e; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js index bc12523103..73f4dc2da8 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js @@ -178,8 +178,10 @@ define(["require", "exports", "tslib", "../Ajax", "../Core", "../Event/Handler", catch (e) { // The `Notification` constructor is not available on Android. // See https://bugs.chromium.org/p/chromium/issues/detail?id=481856 - if (e.name === "TypeError") { - return; + if (e instanceof Error) { + if (e.name === "TypeError") { + return; + } } throw e; } -- 2.20.1