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.

ui_init: Properly call reject with an error, not an xhr.

Alex Vandiver18578cc5da00
diff --git a/web/src/ui_init.js b/web/src/ui_init.js
index 8e1d4fb81ad..6ac1f7c5cab 100644
--- a/web/src/ui_init.js
+++ b/web/src/ui_init.js
@@ -731,8 +731,19 @@ $(async () => {
}),
client_gravatar: false,
};
- const {result, msg, ...state} = await new Promise((success, error) => {
- channel.post({url: "/json/register", data, success, error});
+ const {result, msg, ...state} = await new Promise((resolve, reject) => {
+ channel.post({
+ url: "/json/register",
+ data,
+ resolve,
+ error(xhr) {
+ blueslip.error("Spectator failed to register", {
+ status: xhr.status,
+ bodt: xhr.responseText,
+ });
+ reject(new Error("Spectator failed to register"));
+ },
+ });
});
Object.assign(page_params, state);
}