mirror of https://github.com/zulip/zulip.git
ui_init: Properly call reject with an error, not an xhr.
If the spectator registration call fails, properly log the error and call `reject` with an error object, not the xhr that `channel.post` calls its error callback with. This does nothing to address the UI question of what to do should this request fail.
This commit is contained in:
parent
b312a86ada
commit
18578cc5da
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue