-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
Closed as not planned
Labels
invalidIssues and PRs that are invalid.Issues and PRs that are invalid.
Description
Version
20.1.0
Platform
Linux 6.2.0-32-generic #32~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 18 10:40:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
When defining a stacktrace using Error.prepareStackTrace = function(_,stack) {...}
As of node version 20.1.0 the function isn't called anymore.
try {
var sourceMapSupport = require('source-map-support' + '');
} catch (_) {
sourceMapSupport = null;
}
function getCaller3Info() {
if (this === undefined) {
// Cannot access caller info in 'strict' mode.
return;
}
var obj = {};
var saveLimit = Error.stackTraceLimit;
var savePrepare = Error.prepareStackTrace;
Error.stackTraceLimit = 3;
Error.prepareStackTrace = function (_, stack) {
var caller = stack[2];
if (sourceMapSupport) {
caller = sourceMapSupport.wrapCallSite(caller);
}
obj.file = caller.getFileName();
obj.line = caller.getLineNumber();
var func = caller.getFunctionName();
if (func)
obj.func = func;
};
Error.captureStackTrace(this, arguments.callee);
this.stack;
Error.stackTraceLimit = saveLimit;
Error.prepareStackTrace = savePrepare;
return obj;
}
console.log(getCaller3Info());
How often does it reproduce? Is there a required condition?
Any Node version after 20.0.0
What is the expected behavior? Why is that the expected behavior?
Function defined in Error.prepareStackTrace would be called.
What do you see instead?
The function isn't called.
Additional information
No response
Metadata
Metadata
Assignees
Labels
invalidIssues and PRs that are invalid.Issues and PRs that are invalid.