Skip to content

Commit eda8ea6

Browse files
committed
test: add isError fallback for Node 23
1 parent d6c6a7a commit eda8ea6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/test.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ var util = require('util')
66

77
var createError = require('..')
88

9-
// eslint-disable-next-line node/no-deprecated-api
10-
var isError = typeof Error.isError === 'function' ? Error.isError : util.isError
9+
var isError = typeof Error.isError === 'function'
10+
? Error.isError
11+
// eslint-disable-next-line node/no-deprecated-api
12+
: typeof util.isError === 'function'
13+
// eslint-disable-next-line node/no-deprecated-api
14+
? util.isError
15+
// Fallback for Node.js v23: util.isError was removed in Node.js v23 (EOL), and Error.isError was introduced in Node.js v24
16+
: function (err) {
17+
return err instanceof Error
18+
}
1119

1220
var itErrorIsError = typeof Error.isError === 'function'
1321
? it

0 commit comments

Comments
 (0)