mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
refactor(dom) Images showError: rm textStatus, errorThrown
This commit is contained in:
parent
f61dbbadf6
commit
627f08806f
1 changed files with 22 additions and 8 deletions
|
|
@ -73,14 +73,27 @@ var CloudCmd, Util, DOM, CloudFunc;
|
|||
/**
|
||||
* show error image (usualy after error on ajax request)
|
||||
*/
|
||||
this.showError = function(jqXHR, textStatus, errorThrown) {
|
||||
this.showError = function(jqXHR) {
|
||||
var lLoadingImage = lImages.loading(),
|
||||
lErrorImage = lImages.error(),
|
||||
lResponse = jqXHR.responseText,
|
||||
lStatusText = jqXHR.statusText,
|
||||
lStatus = jqXHR.status,
|
||||
lText = (lStatus === 404 ? lResponse : lStatusText);
|
||||
lResponse = '',
|
||||
lStatusText = '',
|
||||
lStatus = 0,
|
||||
lText = '';
|
||||
|
||||
if (jqXHR) {
|
||||
lResponse = jqXHR.responseText;
|
||||
lStatusText = jqXHR.statusText;
|
||||
lStatus = jqXHR.status;
|
||||
lText = lStatus === 404 ? lResponse : lStatusText;
|
||||
|
||||
if (!lText)
|
||||
if (Util.isString(jqXHR))
|
||||
lText = jqXHR;
|
||||
else
|
||||
lText = '';
|
||||
}
|
||||
|
||||
/* если файла не существует*/
|
||||
if ( Util.isContainStr(lText, 'Error: ENOENT, ') )
|
||||
lText = lText.replace('Error: ENOENT, n','N');
|
||||
|
|
@ -99,9 +112,10 @@ var CloudCmd, Util, DOM, CloudFunc;
|
|||
|
||||
DOM.hide(lLoadingImage);
|
||||
|
||||
Util.log(lText);
|
||||
|
||||
setTimeout( Util.retExec(alert, lText), 100);
|
||||
if (lText) {
|
||||
Util.log(lText);
|
||||
setTimeout(Util.retExec(alert, lText), 100);
|
||||
}
|
||||
|
||||
return lErrorImage;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue