mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-17 01:01:18 +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);
|
return vm.runInNewContext(code, this.context);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
this.logger.error(e.message);
|
this.logger.error(e.message);
|
||||||
|
return e.message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,10 @@ class Console {
|
|||||||
registerApi() {
|
registerApi() {
|
||||||
let plugin = this.plugins.createPlugin('consoleApi', {});
|
let plugin = this.plugins.createPlugin('consoleApi', {});
|
||||||
plugin.registerAPICall('post', '/embark-api/command', (req, res) => {
|
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') {
|
if (typeof result === 'string') {
|
||||||
return res.send({result});
|
return res.send({result});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user