Skip to content

Commit

Permalink
util: runtime deprecate util.isError
Browse files Browse the repository at this point in the history
PR-URL: #50488
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
  • Loading branch information
marco-ippolito authored and nodejs-github-bot committed Nov 27, 2023
1 parent a0c5b87 commit 7c69c33
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,9 @@ The [`util.isDate()`][] API is deprecated.

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/50488
description: Runtime deprecation.
- version:
- v6.12.0
- v4.8.6
Expand All @@ -1070,9 +1073,11 @@ changes:
description: Documentation-only deprecation.
-->

Type: Documentation-only
Type: Runtime

The [`util.isError()`][] API is deprecated.
The [`util.isError()`][] API is deprecated. Please use
`Object.prototype.toString(arg) === '[object Error]' || arg instanceof Error`
instead.

### DEP0049: `util.isFunction()`

Expand Down
8 changes: 6 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,13 @@ module.exports = {
'The `util.isObject` API is deprecated. Please use `typeof arg === "object"` instead.',
'DEP0053'),
isDate: deprecate(types.isDate,
'The `util.isDate` API is deprecated. Please use `arg instanceof Error` instead.',
'The `util.isDate API is deprecated. Please use `arg instanceof Error` instead.',
'DEP0047'),
isError: deprecate(isError, 'The `util.isError API is deprecated.', 'DEP0048'),
isError: deprecate(isError,
'The `util.isError` API is deprecated. ' +
'Please use `ObjectPrototypeToString(e) === "[object Error]" ' +
'|| e instanceof Error` instead.',
'DEP0048'),
isFunction: deprecate(isFunction, 'The `util.isFunction API is deprecated.', 'DEP0049'),
isPrimitive: deprecate(isPrimitive, 'The `util.isPrimitive API is deprecated.', 'DEP0054'),
log: deprecate(log, 'The `util.log API is deprecated.', 'DEP0059'),
Expand Down

0 comments on commit 7c69c33

Please sign in to comment.