mirror of https://github.com/embarklabs/embark.git
return error message on console error
This commit is contained in:
parent
939642f74c
commit
e6964c75cb
|
@ -14,6 +14,7 @@ class RunCode {
|
|||
return vm.runInNewContext(code, this.context);
|
||||
} catch(e) {
|
||||
this.logger.error(e.message);
|
||||
return e.message;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,10 @@ class Console {
|
|||
registerApi() {
|
||||
let plugin = this.plugins.createPlugin('consoleApi', {});
|
||||
plugin.registerAPICall('post', '/embark-api/command', (req, res) => {
|
||||
this.executeCmd(req.body.command, (_err, result) => {
|
||||
this.executeCmd(req.body.command, (err, result) => {
|
||||
if (err) {
|
||||
return res.send({result: err.message || err});
|
||||
}
|
||||
if (typeof result === 'string') {
|
||||
return res.send({result});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue