refactor(console) stringfyJSON(error) -> error.message

This commit is contained in:
coderaiser 2014-07-09 02:38:46 -04:00
parent f41ff4bbca
commit 4c9e9fbfec

View file

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