1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 14:42:10 +00:00

update api err msg and common.ajaxErrorHandler

This commit is contained in:
lian
2015-09-01 17:42:54 +08:00
parent ab6014748b
commit acc2f75235
3 changed files with 111 additions and 91 deletions

View File

@@ -151,7 +151,18 @@ define([
ajaxErrorHandler: function(xhr, textStatus, errorThrown) {
if (xhr.responseText) {
this.feedback($.parseJSON(xhr.responseText).error, 'error');
var parsed_resp = $.parseJSON(xhr.responseText);
if (parsed_resp.hasOwnProperty('error')) {
/* error msg from seahub ajax */
this.feedback(parsed_resp.error, 'error');
} else if (parsed_resp.hasOwnProperty('error_msg')) {
/* error msg from seahub api */
this.feedback(parsed_resp.error_msg, 'error');
} else {
this.feedback(gettext("Error"), 'error');
}
} else {
this.feedback(gettext("Failed. Please check the network."), 'error');
}