Skip to content

Commit 7c69c33

Browse files
marco-ippolitonodejs-github-bot
authored andcommitted
util: runtime deprecate util.isError
PR-URL: #50488 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent a0c5b87 commit 7c69c33

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

doc/api/deprecations.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,9 @@ The [`util.isDate()`][] API is deprecated.
10581058

10591059
<!-- YAML
10601060
changes:
1061+
- version: REPLACEME
1062+
pr-url: https://github.com/nodejs/node/pull/50488
1063+
description: Runtime deprecation.
10611064
- version:
10621065
- v6.12.0
10631066
- v4.8.6
@@ -1070,9 +1073,11 @@ changes:
10701073
description: Documentation-only deprecation.
10711074
-->
10721075

1073-
Type: Documentation-only
1076+
Type: Runtime
10741077

1075-
The [`util.isError()`][] API is deprecated.
1078+
The [`util.isError()`][] API is deprecated. Please use
1079+
`Object.prototype.toString(arg) === '[object Error]' || arg instanceof Error`
1080+
instead.
10761081

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

lib/util.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,13 @@ module.exports = {
430430
'The `util.isObject` API is deprecated. Please use `typeof arg === "object"` instead.',
431431
'DEP0053'),
432432
isDate: deprecate(types.isDate,
433-
'The `util.isDate` API is deprecated. Please use `arg instanceof Error` instead.',
433+
'The `util.isDate API is deprecated. Please use `arg instanceof Error` instead.',
434434
'DEP0047'),
435-
isError: deprecate(isError, 'The `util.isError API is deprecated.', 'DEP0048'),
435+
isError: deprecate(isError,
436+
'The `util.isError` API is deprecated. ' +
437+
'Please use `ObjectPrototypeToString(e) === "[object Error]" ' +
438+
'|| e instanceof Error` instead.',
439+
'DEP0048'),
436440
isFunction: deprecate(isFunction, 'The `util.isFunction API is deprecated.', 'DEP0049'),
437441
isPrimitive: deprecate(isPrimitive, 'The `util.isPrimitive API is deprecated.', 'DEP0054'),
438442
log: deprecate(log, 'The `util.log API is deprecated.', 'DEP0059'),

0 commit comments

Comments
 (0)