Make Notification/Handler.ts compatible with useUnknownInCatchVariables
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 13 Dec 2021 13:46:59 +0000 (14:46 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 13 Dec 2021 13:46:59 +0000 (14:46 +0100)
ts/WoltLabSuite/Core/Notification/Handler.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js

index 9befaf7487e1caacf02468060cec37eaacef8fc7..04a5ad6f1be895f8687d15201e1ecf14880bfbd0 100644 (file)
@@ -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;
index bc12523103ca9f591cf0cf21980f7c794dc34103..73f4dc2da8c9e472651fd75997a7bd3c6ed2f169 100644 (file)
@@ -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;
                 }