diff --git a/cmd/dashboard/console.js b/cmd/dashboard/console.js index bb3100ed..8caaa3d0 100644 --- a/cmd/dashboard/console.js +++ b/cmd/dashboard/console.js @@ -62,7 +62,7 @@ class Console { if (this.ipc.connected && this.ipc.isClient()) { return this.ipc.request('console:executeCmd', cmd, callback); } - callback(e.message); + callback(e); } } } diff --git a/cmd/dashboard/monitor.js b/cmd/dashboard/monitor.js index c9eea8c8..f5ba4bbd 100644 --- a/cmd/dashboard/monitor.js +++ b/cmd/dashboard/monitor.js @@ -368,10 +368,11 @@ class Monitor { executeCmd(cmd, cb) { const self = this; self.logText.log('console> '.bold.green + cmd); - self.console.executeCmd(cmd, function (_err, result) { - self.logText.log(result); + self.console.executeCmd(cmd, function (err, result) { + let message = err || result; + self.logText.log(message); if (cb) { - cb(result); + cb(message); } }); } diff --git a/lib/core/ipc.js b/lib/core/ipc.js index 5aad37b4..49b0c6a3 100644 --- a/lib/core/ipc.js +++ b/lib/core/ipc.js @@ -51,15 +51,15 @@ class IPC { if (data.action !== action) { return; } - let reply = function(_err, replyData) { - self.reply(socket, action, replyData); + let reply = function(error, replyData) { + self.reply(socket, action, error, replyData); }; done(data.message, reply, socket); }); } - reply(client, action, data) { - ipc.server.emit(client, 'message', {action: action, message: data}); + reply(client, action, error, data) { + ipc.server.emit(client, 'message', {action: action, message: data, error: (error && error.stack)}); } listenTo(action, callback) { @@ -75,7 +75,7 @@ class IPC { if (msg.action !== action) { return; } - cb(null, msg.message); + cb(msg.error, msg.message); }); } diff --git a/lib/core/modules/coderunner/runCode.js b/lib/core/modules/coderunner/runCode.js index 799a324d..4e354213 100644 --- a/lib/core/modules/coderunner/runCode.js +++ b/lib/core/modules/coderunner/runCode.js @@ -11,12 +11,8 @@ function initContext() { // for now it is defined here // ====================== function doEval(code) { - try { - // TODO: add trace log here - return eval(code); - } catch(e) { - throw new Error(e + "\n" + code); - } + // TODO: add trace log here + return eval(code); } function registerVar(varName, code) {