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_stacktrace: Fix logic for chained exceptions.

Anders Kaseorg6ada80513ff8
diff --git a/web/src/blueslip_stacktrace.ts b/web/src/blueslip_stacktrace.ts
index 40a129b6ebe..5e989605337 100644
--- a/web/src/blueslip_stacktrace.ts
+++ b/web/src/blueslip_stacktrace.ts
@@ -123,7 +123,7 @@ export async function display_stacktrace(ex: unknown, message?: string): Promise
"constructor" in prototype
? `thrown ${prototype.constructor.name}`
: "thrown",
- message: ex === undefined ? message : `${String(ex)}: ${message}`,
+ message: ex === undefined || ex === null ? message : JSON.stringify(ex),
stackframes: [],
});
break;
@@ -158,7 +158,7 @@ export async function display_stacktrace(ex: unknown, message?: string): Promise
stackframes,
});
ex = ex.cause;
- } while (ex !== undefined);
+ } while (ex !== undefined && ex !== null);
const $alert = $("<div>").addClass("stacktrace").html(render_blueslip_stacktrace({errors}));
$(".alert-box").append($alert);