refactor(dom) Images showError: rm textStatus, errorThrown

This commit is contained in:
coderaiser 2013-09-13 10:14:09 +00:00
parent f61dbbadf6
commit 627f08806f

View file

@ -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;
};