-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.errorsIssues and PRs related to JavaScript errors originated in Node.js core.Issues and PRs related to JavaScript errors originated in Node.js core.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
Description
function MyError() {
Error.captureStackTrace(this, MyError);
}
// Without passing MyError to captureStackTrace, the MyError
// frame would show up in the .stack property. By passing
// the constructor, we omit that frame and all frames above it.
new MyError().stack;
Result:
Error
at Object.<anonymous> (/Users/mjayaraman/SVNFiles/node/course/error.js:8:11)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Function.Module.runMain (module.js:575:10)
at startup (node.js:160:18)
at node.js:456:3
function MyError() {
Error.captureStackTrace(this);
}
// Without passing MyError to captureStackTrace, the MyError
// frame would show up in the .stack property. By passing
// the constructor, we omit that frame and all frames above it.
new MyError().stack;
Error
at new MyError (/Users/mjayaraman/SVNFiles/node/course/error.js:2:9)
at Object.<anonymous> (/Users/mjayaraman/SVNFiles/node/course/error.js:8:11)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Function.Module.runMain (module.js:575:10)
at startup (node.js:160:18)
at node.js:456:3
Meaning, it just omits that frame, if we pass the constructor and not the above frames.
// the constructor, we omit that frame and all frames above it.
To be changed to
// the constructor, we omit that frame.
or
// the constructor, we omit that frame, and retain all frames above it.
- Version:
- Platform:
- Subsystem:
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.errorsIssues and PRs related to JavaScript errors originated in Node.js core.Issues and PRs related to JavaScript errors originated in Node.js core.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.