Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
new Error() to call prepareStackTrace
  • Loading branch information
danilobatistaqueiroz committed Sep 18, 2023
commit 39983cc349bbf103ba8b15c45d7f3f32fc095ebb
7 changes: 4 additions & 3 deletions lib/bunyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ function getCaller3Info() {
var obj = {};
var saveLimit = Error.stackTraceLimit;
var savePrepare = Error.prepareStackTrace;
Error.stackTraceLimit = 3;
Error.stackTraceLimit = 4;

Error.prepareStackTrace = function (_, stack) {
var caller = stack[2];
var caller = stack[3];
if (sourceMapSupport) {
caller = sourceMapSupport.wrapCallSite(caller);
}
Expand All @@ -197,7 +197,8 @@ function getCaller3Info() {
obj.func = func;
};
Error.captureStackTrace(this, getCaller3Info);
this.stack;
const err = new Error();
err.stack;

Error.stackTraceLimit = saveLimit;
Error.prepareStackTrace = savePrepare;
Expand Down