From 4c9e9fbfec47f7734eeb74875ff53128dc349d2e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 9 Jul 2014 02:38:46 -0400 Subject: [PATCH] refactor(console) stringfyJSON(error) -> error.message --- lib/server/console.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/server/console.js b/lib/server/console.js index bee78293..7bc3af5b 100644 --- a/lib/server/console.js +++ b/lib/server/console.js @@ -175,10 +175,12 @@ */ function setExec(callback, error, stdout, stderr) { var json, - errorStr = stderr || error; - - if (errorStr) - errorStr = addNewLine(errorStr + ''); + errorStr = ''; + + if (stderr) + errorStr = stderr; + else if (error) + errorStr = error.message; json = { stdout : stdout, @@ -283,16 +285,14 @@ command = 'cd ' + path.join(currDir, paramDir); exec(command + ' && ' + getDir, {cwd : currDir}, function (error, stdout, stderr) { - var errorStr = '', - errorData = stderr || error, - isStr = Util.isString(errorData); + var errorStr = ''; - if (errorData && !isStr) - errorStr = Util.stringifyJSON(errorData); - else - errorStr = errorData; + if (stderr) + errorStr = stderr; + else if (error) + errorStr = error.message; - callback(errorData, { + callback(error || stderr, { stderr : errorStr, path : CloudFunc.rmNewLine(stdout) });