Skip to content

Commit

Permalink
doc: deprecate calling promisify on a function that returns a promise
Browse files Browse the repository at this point in the history
PR-URL: #49647
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
aduh95 authored Sep 16, 2023
1 parent ae73d48 commit 71b90fa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3383,6 +3383,20 @@ In a future version of Node.js, [`assert.CallTracker`][],
will be removed.
Consider using alternatives such as the [`mock`][] helper function.

### DEP0174: calling `promisify` on a function that returns a `Promise`

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/49647
description: Documentation-only deprecation.
-->

Type: Documentation-only

Calling [`util.promisify`][] on a function that returns a <Promise> will ignore
the result of said promise, which can lead to unhandled promise rejections.

[NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
[RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3
[RFC 8247 Section 2.4]: https://www.rfc-editor.org/rfc/rfc8247#section-2.4
Expand Down Expand Up @@ -3523,6 +3537,7 @@ Consider using alternatives such as the [`mock`][] helper function.
[`util.isSymbol()`]: util.md#utilissymbolobject
[`util.isUndefined()`]: util.md#utilisundefinedobject
[`util.log()`]: util.md#utillogstring
[`util.promisify`]: util.md#utilpromisifyoriginal
[`util.types`]: util.md#utiltypes
[`util`]: util.md
[`worker.exitedAfterDisconnect`]: cluster.md#workerexitedafterdisconnect
Expand Down
5 changes: 5 additions & 0 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,11 @@ $ node negate.js --no-logfile --logfile=test.log --color --no-color
<!-- YAML
added: v8.0.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/49647
description: Calling `promisify` on a function that returns a `Promise` is
deprecated.
-->
* `original` {Function}
Expand Down

0 comments on commit 71b90fa

Please sign in to comment.