console: fix trace function
A recent refactoring made the slight mistake of calling `trace()` instead of `this.trace()`. PR-URL: https://github.com/nodejs/node/pull/26764 Fixes: https://github.com/nodejs/node/issues/26763 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
This commit is contained in:
parent
296712602b
commit
ab3f7afacc
@ -331,7 +331,7 @@ const consoleMethods = {
|
||||
name: 'Trace',
|
||||
message: this[kFormatForStderr](args)
|
||||
};
|
||||
Error.captureStackTrace(err, trace);
|
||||
Error.captureStackTrace(err, this.trace);
|
||||
this.error(err.stack);
|
||||
},
|
||||
|
||||
|
5
test/message/console.js
Normal file
5
test/message/console.js
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
|
||||
console.trace('foo');
|
10
test/message/console.out
Normal file
10
test/message/console.out
Normal file
@ -0,0 +1,10 @@
|
||||
Trace: foo
|
||||
at Object.trace (*)
|
||||
at Object.<anonymous> (*console.js:*:*)
|
||||
at *
|
||||
at *
|
||||
at *
|
||||
at *
|
||||
at *
|
||||
at *
|
||||
at *
|
Loading…
x
Reference in New Issue
Block a user