Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

blueslip: Show popups for unhandled promise rejections in development.

Anders Kaseorgf35e1fdef6bb
diff --git a/web/src/blueslip.ts b/web/src/blueslip.ts
index 825c946c6af..c4d760e34ec 100644
--- a/web/src/blueslip.ts
+++ b/web/src/blueslip.ts
@@ -115,4 +115,10 @@ if (DEVELOPMENT) {
void display_stacktrace(originalEvent.error);
}
});
+ $(window).on("unhandledrejection", (event: JQuery.TriggeredEvent) => {
+ const {originalEvent} = event;
+ if (originalEvent instanceof PromiseRejectionEvent) {
+ void display_stacktrace(originalEvent.reason);
+ }
+ });
}