From 6a9f0499688b7515f3156a1754583d7624b25989 Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Thu, 15 Mar 2018 14:22:43 +0100 Subject: tools,lib: forbid native Error constructors This adds a rule that forbids the use of native Error constructors in the `lib` directory. This is to encourage use of the `internal/errors` mechanism. The rule is disabled for errors that are not created with the `internal/errors` module but are still assigned an error code. PR-URL: https://github.com/nodejs/node/pull/19373 Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell --- lib/buffer.js | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/buffer.js') diff --git a/lib/buffer.js b/lib/buffer.js index b369d27a1e..c11762aa57 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -1073,6 +1073,7 @@ if (process.binding('config').hasIntl) { return result; const code = icuErrName(result); + // eslint-disable-next-line no-restricted-syntax const err = new Error(`Unable to transcode Buffer [${code}]`); err.code = code; err.errno = result; -- cgit v1.2.3