-
Notifications
You must be signed in to change notification settings - Fork 22.6k
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
Reference for de-facto interoperable V8 Stack trace API props #38048
Conversation
a729dcb
to
7f6620e
Compare
- : A non-standard V8 numerical property that limits how many stack frames to include in an error stacktrace. | ||
- `Error.prepareStackTrace()` {{non-standard_inline}} {{optional_inline}} | ||
- : A non-standard V8 function that, if provided by user code, is called by the V8 JavaScript engine for thrown exceptions, allowing the user to provide custom formatting for stacktraces. | ||
- {{jsxref("Error.captureStackTrace()")}} {{non-standard_inline}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is now https://github.com/mgaudet/proposal-error-capturestacktrace - at what point does a proposal create enough of a spec that we can start saying this is on the standards track?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be proposed for standards track at the February TC39 meeting. It will be standards track after its acceptance.
files/en-us/web/javascript/reference/global_objects/error/capturestacktrace/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/error/capturestacktrace/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/error/capturestacktrace/index.md
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/error/capturestacktrace/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/error/stacktracelimit/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/error/stacktracelimit/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/javascript/reference/global_objects/error/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
@@ -10,7 +10,7 @@ browser-compat: javascript.builtins.Error.captureStackTrace | |||
{{JSRef}}{{Non-standard_Header}} | |||
|
|||
> [!NOTE] | |||
> This feature is part of the currently non-standard [V8 stack trace API](https://v8.dev/docs/stack-trace-api). However, due to compatibility reasons, it is de facto implemented by all major JavaScript engines. | |||
> This feature is part of the non-standard [V8 stack trace API](https://v8.dev/docs/stack-trace-api). However, for compatibility reasons, it is de facto implemented by all major JavaScript engines. | |||
|
|||
The **`Error.captureStackTrace()`** static method installs stack trace information on a provided object as the [`stack`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack) property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Josh-Cena Just remembered one more thing - somewhere here we should mention that the stacktrace is not the entire stack - its some amount that is considered relevant to users. Then cross link to say that if Error.stackTraceLimit is supported that can be used to set the max size of the returned stack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is implied by "follows the same format as {{jsxref("Error.prototype.stack")}}". The reason I want to be handwavy about it is because Firefox doesn't support stackTraceLimit
and doesn't plan to, so in FF the stack is uncustomizable anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. I would have added something anyway, but your call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks so much for this! Approving.
Part of #37930.
I'm not documenting
prepareStackTrace
because (a) it's only supported by V8 (b) it's too big and complex and prone to changes.