-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code example in the docs of Error.captureStackTrace needs better wording #12289
Comments
Added in #789, based on that maybe cc/ @Fishrock123 @jasnell @trevnorris ? |
Above, not below 😉. |
It actual meaning is that it omits the frames that are function foo() {
bar()
}
function bar() {
baz()
}
function baz() {
function MyError() {
Error.captureStackTrace(this, bar)
}
var e = new MyError()
console.log(e.stack)
}
foo()
|
Edited the title to be clearer about what this issue is about. |
Hi, I made the change, please let me know if its good to go. Thanks |
Edit to the comment in the stack trace capture, highlighting the use of the constructorOpt argument in errors.md Fixes: #12289 PR-URL: #12962 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Ruben Bridgewater <ruben.bridgewater@fintura.de>
Ref: https://nodejs.org/dist/latest-v7.x/docs/api/errors.html#errors_error_capturestacktrace_targetobject_constructoropt
Result:
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.
The text was updated successfully, but these errors were encountered: