feature(util) rm tryLog, logError

This commit is contained in:
coderaiser 2014-10-29 04:45:50 -04:00
parent 28da3c2e76
commit d65a349c70
2 changed files with 4 additions and 42 deletions

View file

@ -46,14 +46,12 @@
if (error) {
callback(error);
} else {
error = Util.exec.tryLog(function() {
error = Util.exec.try(function() {
diffResult = diff.applyPatch(data, patch);
});
if (error || !diffResult)
callback({
message: 'Patch fail'
});
if (error)
callback(error);
else
fs.writeFile(name, diffResult, callback);
}

View file

@ -190,7 +190,7 @@
this.stringify = function(obj) {
var str;
Util.exec.tryLog(function() {
Util.exec.try(function() {
str = JSON.stringify(obj, null, 4);
});
@ -255,25 +255,6 @@
return args.join(' ');
};
/**
* function log pArg if it's not empty
* @param pArg
*/
this.logError = function(pArg) {
var lConsole = Scope.console,
lDate = '[' + Util.getDate() + '] ';
if (lConsole && pArg) {
var lMsg = pArg.message;
if (lMsg)
lDate += pArg.message + ' ';
lConsole.error(lDate, pArg);
}
return pArg;
};
/**
* function remove substring from string
* @param str
@ -690,23 +671,6 @@
return ret;
};
/**
* function execute param function in
* try...catch block and log result
*
* @param tryFunc
*/
exec.tryLog = function(tryFunc) {
var ret;
ret = this.try(tryFunc);
return Util.logError(ret);
};
return exec;
}
/**
* function gets file extension
* @param pFileName