diff --git a/lib/console.js b/lib/console.js index 7ec9c846329cce..a3506247906f4a 100644 --- a/lib/console.js +++ b/lib/console.js @@ -150,11 +150,10 @@ Console.prototype.timeEnd = function timeEnd(label) { Console.prototype.trace = function trace(...args) { - // TODO probably can to do this better with V8's debug object once that is - // exposed. - var err = new Error(); - err.name = 'Trace'; - err.message = util.format.apply(null, args); + const err = { + name: 'Trace', + message: util.format.apply(null, args) + }; Error.captureStackTrace(err, trace); this.error(err.stack); };