mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-27 05:56:21 +00:00
Use trace logger for code runner error
This commit is contained in:
parent
8c3ac34fac
commit
b41bcbbe17
@ -8,7 +8,7 @@ class CodeRunner {
|
||||
this.events = options.events;
|
||||
this.ipc = options.ipc;
|
||||
this.commands = [];
|
||||
this.runCode = new RunCode();
|
||||
this.runCode = new RunCode({logger: this.logger});
|
||||
this.registerIpcEvents();
|
||||
this.IpcClientListen();
|
||||
this.registerEvents();
|
||||
|
@ -1,7 +1,8 @@
|
||||
const vm = require('vm');
|
||||
|
||||
class RunCode {
|
||||
constructor() {
|
||||
constructor({logger}) {
|
||||
this.logger = logger;
|
||||
this.context = Object.assign({}, {global, console, exports, require, module, __filename, __dirname});
|
||||
}
|
||||
|
||||
@ -9,7 +10,7 @@ class RunCode {
|
||||
try {
|
||||
return vm.runInNewContext(code, this.context);
|
||||
} catch(e) {
|
||||
console.error(e.message);
|
||||
this.logger.trace(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user