mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-10 14:06:10 +00:00
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…
x
Reference in New Issue
Block a user