mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
Move xhr_error_message() into channel.js
(imported from commit c68c2d475b5673a3dd5f68c75624dfcfe56728ca)
This commit is contained in:
committed by
Leo Franchi
parent
0e129614cf
commit
3889edd824
@@ -110,6 +110,15 @@ exports.patch = function (options) {
|
||||
return exports.post(options, options.idempotent);
|
||||
};
|
||||
|
||||
exports.xhr_error_message = function (message, xhr) {
|
||||
if (xhr.status.toString().charAt(0) === "4") {
|
||||
// Only display the error response for 4XX, where we've crafted
|
||||
// a nice response.
|
||||
message += ": " + $.parseJSON(xhr.responseText).msg;
|
||||
}
|
||||
return message;
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
}());
|
||||
|
||||
Reference in New Issue
Block a user