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.

util: Stringify possibly undefined values.

Zixuan James Li55793cb4d540
diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js
index d44b7bacae1..f9e9d9bad72 100644
--- a/frontend_tests/node_tests/drafts.js
+++ b/frontend_tests/node_tests/drafts.js
@@ -413,7 +413,7 @@ test("catch_buggy_draft_error", () => {
// An error is logged but the draft isn't fixed in this codepath.
blueslip.expect(
"error",
- "Cannot compare strings; at least one value is undefined: undefined, old_topic",
+ "Cannot compare strings; at least one value is undefined: (undefined), old_topic",
);
drafts.rename_stream_recipient(
stream_B.stream_id,
diff --git a/static/js/util.js b/static/js/util.js
index f20aad4bc5e..fe5a722d783 100644
--- a/static/js/util.js
+++ b/static/js/util.js
@@ -41,7 +41,10 @@ export function lower_bound(array, value, less) {
export const lower_same = function lower_same(a, b) {
if (a === undefined || b === undefined) {
- blueslip.error(`Cannot compare strings; at least one value is undefined: ${a}, ${b}`);
+ blueslip.error(
+ `Cannot compare strings; at least one value is undefined: \
+${a ?? "(undefined)"}, ${b ?? "(undefined)"}`,
+ );
return false;
}
return a.toLowerCase() === b.toLowerCase();