doc: deprecate utilisNativeError in favor of ErrorisError

PR-URL: https://github.com/nodejs/node/pull/58262
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
This commit is contained in:
Miguel Marcondes Filho 2025-06-08 00:46:12 -03:00 committed by GitHub
parent 3b111eb3f5
commit 60155daf8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View File

@ -4016,6 +4016,20 @@ To make [`child_process.exec`][] invoke the default shell, either omit the
`shell` option, or set it to a nullish value. If the intention is not to invoke
a shell, use [`child_process.execFile`][] instead.
### DEP0197: `util.types.isNativeError()`
<!-- YAML
changes:
- version:
- REPLACEME
pr-url: https://github.com/nodejs/node/pull/58262
description: Documentation-only deprecation.
-->
Type: Documentation-only
The [`util.types.isNativeError`][] API is deprecated. Please use [`Error.isError`][] instead.
[DEP0142]: #dep0142-repl_builtinlibs
[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
@ -4034,6 +4048,7 @@ a shell, use [`child_process.execFile`][] instead.
[`Buffer.isBuffer()`]: buffer.md#static-method-bufferisbufferobj
[`Cipheriv`]: crypto.md#class-cipheriv
[`Decipheriv`]: crypto.md#class-decipheriv
[`Error.isError`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/isError
[`REPLServer.clearBufferedCommand()`]: repl.md#replserverclearbufferedcommand
[`ReadStream.open()`]: fs.md#class-fsreadstream
[`Server.getConnections()`]: net.md#servergetconnectionscallback
@ -4146,6 +4161,7 @@ a shell, use [`child_process.execFile`][] instead.
[`util.isArray()`]: util.md#utilisarrayobject
[`util.promisify`]: util.md#utilpromisifyoriginal
[`util.toUSVString()`]: util.md#utiltousvstringstring
[`util.types.isNativeError`]: util.md#utiltypesisnativeerrorvalue
[`util.types`]: util.md#utiltypes
[`util`]: util.md
[`worker.exitedAfterDisconnect`]: cluster.md#workerexitedafterdisconnect

View File

@ -3328,8 +3328,14 @@ util.types.isModuleNamespaceObject(ns); // Returns true
<!-- YAML
added: v10.0.0
deprecated: REPLACEME
-->
> Stability: 0 - Deprecated: Use [`Error.isError`][] instead.
**Note:** As of Node.js v24, `Error.isError()` is currently slower than `util.types.isNativeError()`.
If performance is critical, consider benchmarking both in your environment.
* `value` {any}
* Returns: {boolean}
@ -3716,6 +3722,7 @@ util.isArray({});
[`'warning'`]: process.md#event-warning
[`Array.isArray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
[`ArrayBuffer.isView()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView
[`Error.isError`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/isError
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
[`MIMEparams`]: #class-utilmimeparams
[`Object.assign()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign