From d65a349c70632ff8d83f217b20ff8f77481fb4e9 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 29 Oct 2014 04:45:50 -0400 Subject: [PATCH] feature(util) rm tryLog, logError --- lib/server/patch.js | 8 +++----- lib/util.js | 38 +------------------------------------- 2 files changed, 4 insertions(+), 42 deletions(-) diff --git a/lib/server/patch.js b/lib/server/patch.js index a75e1e5b..b9fa75e5 100644 --- a/lib/server/patch.js +++ b/lib/server/patch.js @@ -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); } diff --git a/lib/util.js b/lib/util.js index 65ad0cde..7b6632c2 100644 --- a/lib/util.js +++ b/lib/util.js @@ -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