mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 05:58:25 +00:00
Show server errors in the message edit form.
Refactor common code from compose into a util function. Trac #1455, #1448 (imported from commit 6fb691ac952b833655584b05f6caedaefe41c1a0)
This commit is contained in:
@@ -253,5 +253,15 @@ exports.array_compare = function util_array_compare(a, b) {
|
||||
return true;
|
||||
};
|
||||
|
||||
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