doc: correct description of error.stack accessor behavior

PR-URL: https://github.com/nodejs/node/pull/61090
Refs: https://github.com/nodejs/node/issues/60862
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
René authored and GitHub committed 2026-01-09 04:12:19 +00:00
1 parent 3bb0135783
commit a327288cc6
1 file changed
+8 -3
+8 -3
View File
@@ -379,13 +379,17 @@ The location information will be one of:
represents a call in a user program (using ES module system), or
its dependencies.
The string representing the stack trace is lazily generated when the
`error.stack` property is **accessed**.
The number of frames captured by the stack trace is bounded by the smaller of
`Error.stackTraceLimit` or the number of available frames on the current event
loop tick.
`error.stack` is a getter/setter for a hidden internal property which is only
present on builtin `Error` objects (those for which [`Error.isError`][] returns
true). If `error` is not a builtin error object, then the `error.stack` getter
will always return `undefined`, and the setter will do nothing. This can occur
if the accessor is manually invoked with a `this` value that is not a builtin
error object, such as a {Proxy}.
## Class: `AssertionError`
* Extends: {errors.Error}
@@ -4381,6 +4385,7 @@ An error occurred trying to allocate memory. This should never happen.
[`ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST`]: #err_missing_message_port_in_transfer_list
[`ERR_MISSING_TRANSFERABLE_IN_TRANSFER_LIST`]: #err_missing_transferable_in_transfer_list
[`ERR_REQUIRE_ASYNC_MODULE`]: #err_require_async_module
[`Error.isError`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/isError
[`EventEmitter`]: events.md#class-eventemitter
[`MessagePort`]: worker_threads.md#class-messageport
[`Object.getPrototypeOf`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf