From f0dd12dbc19bba55ab14c90c7a3d1b5e7392175e Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Fri, 15 Dec 2023 05:16:30 -0500 Subject: [PATCH] Log unhandled promise rejections in the rageshake (#12028) --- src/rageshake/rageshake.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rageshake/rageshake.ts b/src/rageshake/rageshake.ts index 261cef51f5..aa80e463fb 100644 --- a/src/rageshake/rageshake.ts +++ b/src/rageshake/rageshake.ts @@ -500,6 +500,11 @@ export function init(setUpPersistence = true): Promise { global.mx_rage_logger = new ConsoleLogger(); global.mx_rage_logger.monkeyPatch(window.console); + // log unhandled rejections in the rageshake + window.addEventListener("unhandledrejection", (event) => { + global.mx_rage_logger.log("error", `Unhandled promise rejection: ${event.reason}`); + }); + if (setUpPersistence) { return tryInitStorage(); }