IPC works with errors, console print errors
This commit is contained in:
parent
dd8658a59a
commit
a59cc29d39
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue