From b41bcbbe174c06734143ac1b5b5dfefc20626239 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Mon, 10 Sep 2018 09:26:37 +0100 Subject: [PATCH] Use trace logger for code runner error --- lib/core/modules/coderunner/codeRunner.js | 2 +- lib/core/modules/coderunner/runCode.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/core/modules/coderunner/codeRunner.js b/lib/core/modules/coderunner/codeRunner.js index 61fbbd894..167e23f65 100644 --- a/lib/core/modules/coderunner/codeRunner.js +++ b/lib/core/modules/coderunner/codeRunner.js @@ -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(); diff --git a/lib/core/modules/coderunner/runCode.js b/lib/core/modules/coderunner/runCode.js index 0fc2ff6cc..a38ff7d82 100644 --- a/lib/core/modules/coderunner/runCode.js +++ b/lib/core/modules/coderunner/runCode.js @@ -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); } }