mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(dom) Images.show.error: jqXHR -> text
This commit is contained in:
parent
9361dac428
commit
aec152d793
3 changed files with 15 additions and 27 deletions
|
|
@ -109,34 +109,13 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
return image;
|
||||
}
|
||||
|
||||
function error(jqXHR, isQuiet) {
|
||||
var isStr = Util.type.string(jqXHR),
|
||||
image = Images.error(),
|
||||
response = '',
|
||||
statusText = '',
|
||||
status = 0,
|
||||
text = '';
|
||||
|
||||
if (jqXHR)
|
||||
if (isStr) {
|
||||
text = jqXHR;
|
||||
} else {
|
||||
response = jqXHR.responseText;
|
||||
statusText = jqXHR.statusText;
|
||||
status = jqXHR.status;
|
||||
text = status === 404 ? response : statusText;
|
||||
}
|
||||
function error(text) {
|
||||
var image = Images.error();
|
||||
|
||||
DOM.show(image);
|
||||
image.title = text;
|
||||
|
||||
if (text)
|
||||
setTimeout(function() {
|
||||
if (!isQuiet)
|
||||
Dialog.alert(text);
|
||||
|
||||
CloudCmd.log(text);
|
||||
}, 100);
|
||||
CloudCmd.log(text);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ var Util, DOM;
|
|||
funcError = function() {
|
||||
var callback,
|
||||
template = 'file {{ src }} could not be loaded',
|
||||
isQuit = true,
|
||||
msg = rendy(template, {
|
||||
src: p.src
|
||||
}),
|
||||
|
|
@ -64,7 +63,7 @@ var Util, DOM;
|
|||
|
||||
parent.removeChild(element);
|
||||
|
||||
Images.show.error(msg, isQuit);
|
||||
Images.show.error(msg);
|
||||
|
||||
Util.exec(callback, error);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -187,7 +187,17 @@ var Util, DOM, CloudFunc, CloudCmd;
|
|||
url : p.url,
|
||||
data : p.data,
|
||||
dataType : p.dataType,
|
||||
error : Images.show.error,
|
||||
error : function(jqXHR) {
|
||||
var response = jqXHR.responseText,
|
||||
statusText = jqXHR.statusText,
|
||||
status = jqXHR.status,
|
||||
text = status === 404 ? response : statusText;
|
||||
|
||||
Images.show.error(text);
|
||||
setTimeout(function() {
|
||||
DOM.Dialog.alert(text);
|
||||
}, 100);
|
||||
},
|
||||
success : function(data) {
|
||||
Images.hide();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue