mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 04:24:14 +09:00
Improve error handling and display accurate HTTP status code
This commit is contained in:
parent
3a419d586d
commit
bd6f570027
1 changed files with 14 additions and 6 deletions
|
|
@ -255,7 +255,11 @@ function xml2json(xml, tab, ignoreAttrib) {
|
||||||
if ($.isFunction($.exec_xml.onerror)) {
|
if ($.isFunction($.exec_xml.onerror)) {
|
||||||
return $.exec_xml.onerror(module, act, data, callback_func, response_tags, callback_func_arg, fo_obj);
|
return $.exec_xml.onerror(module, act, data, callback_func, response_tags, callback_func_arg, fo_obj);
|
||||||
}
|
}
|
||||||
alert( (data.message || 'An unknown error occured while loading ['+module+'.'+act+']').replace(/\\n/g, '\n') );
|
if (data.message) {
|
||||||
|
alert(data.message.replace(/\\n/g, "\n"));
|
||||||
|
} else {
|
||||||
|
alert("AJAX communication error while requesting " + params.module + "." + params.act);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -278,7 +282,7 @@ function xml2json(xml, tab, ignoreAttrib) {
|
||||||
success : onsuccess,
|
success : onsuccess,
|
||||||
error : function(xhr, textStatus) {
|
error : function(xhr, textStatus) {
|
||||||
waiting_obj.css('display', 'none');
|
waiting_obj.css('display', 'none');
|
||||||
alert("AJAX communication error while requesting " + params.module + "." + params.act);
|
alert("AJAX communication error while requesting " + params.module + "." + params.act + "\n\n" + xhr.status + " " + xhr.statusText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
|
@ -371,14 +375,18 @@ function xml2json(xml, tab, ignoreAttrib) {
|
||||||
data: data,
|
data: data,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$(".wfsr").hide().trigger('cancel_confirm');
|
$(".wfsr").hide().trigger('cancel_confirm');
|
||||||
if(data.error != '0' && data.error > -1000) {
|
if(data.error != 0 && data.error > -1000) {
|
||||||
if(data.error == -1 && data.message == 'msg_is_not_administrator') {
|
if(data.error == -1 && data.message == 'msg_is_not_administrator') {
|
||||||
alert('You are not logged in as an administrator');
|
alert('You are not logged in as an administrator');
|
||||||
if($.isFunction(callback_error)) callback_error(data);
|
if($.isFunction(callback_error)) callback_error(data);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
alert(data.message);
|
if (data.message) {
|
||||||
|
alert(data.message.replace(/\\n/g, "\n"));
|
||||||
|
} else {
|
||||||
|
alert("AJAX communication error while requesting " + data.module + "." + data.act);
|
||||||
|
}
|
||||||
if($.isFunction(callback_error)) callback_error(data);
|
if($.isFunction(callback_error)) callback_error(data);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -389,7 +397,7 @@ function xml2json(xml, tab, ignoreAttrib) {
|
||||||
},
|
},
|
||||||
error: function(xhr, textStatus) {
|
error: function(xhr, textStatus) {
|
||||||
$(".wfsr").hide();
|
$(".wfsr").hide();
|
||||||
alert("AJAX communication error while requesting " + data.module + "." + data.act);
|
alert("AJAX communication error while requesting " + data.module + "." + data.act + "\n\n" + xhr.status + " " + xhr.statusText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
|
@ -430,7 +438,7 @@ function xml2json(xml, tab, ignoreAttrib) {
|
||||||
},
|
},
|
||||||
error: function(xhr, textStatus) {
|
error: function(xhr, textStatus) {
|
||||||
$(".wfsr").hide();
|
$(".wfsr").hide();
|
||||||
alert("AJAX communication error while requesting " + data.module + "." + data.act);
|
alert("AJAX communication error while requesting " + data.module + "." + data.act + "\n\n" + xhr.status + " " + xhr.statusText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue