lib: fixup more incorrect ERR_INVALID_ARG_VALUE uses

PR-URL: https://github.com/nodejs/node/pull/57177
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
James M Snell 2025-02-22 16:01:09 -08:00 committed by Node.js GitHub Bot
parent e28700930d
commit 85c0f7aef3
4 changed files with 5 additions and 5 deletions

View File

@ -68,7 +68,7 @@ class FSWatcher extends EventEmitter {
if (encoding != null) {
// This is required since on macOS and Windows it throws ERR_INVALID_ARG_VALUE
if (typeof encoding !== 'string') {
throw new ERR_INVALID_ARG_VALUE(encoding, 'options.encoding');
throw new ERR_INVALID_ARG_VALUE('options.encoding', encoding);
}
}

View File

@ -318,7 +318,7 @@ async function* watch(filename, options = kEmptyObject) {
if (encoding && !isEncoding(encoding)) {
const reason = 'is invalid encoding';
throw new ERR_INVALID_ARG_VALUE(encoding, 'encoding', reason);
throw new ERR_INVALID_ARG_VALUE('encoding', encoding, reason);
}
if (signal?.aborted)

View File

@ -2069,7 +2069,7 @@ function processSessionOptions(options, forServer = false) {
if (cc !== undefined) {
validateString(cc, 'options.cc');
if (cc !== 'reno' || cc !== 'bbr' || cc !== 'cubic') {
throw new ERR_INVALID_ARG_VALUE(cc, 'options.cc');
throw new ERR_INVALID_ARG_VALUE('options.cc', cc);
}
}

View File

@ -529,7 +529,7 @@ function newStreamReadableFromReadableStream(readableStream, options = kEmptyObj
} = options;
if (encoding !== undefined && !Buffer.isEncoding(encoding))
throw new ERR_INVALID_ARG_VALUE(encoding, 'options.encoding');
throw new ERR_INVALID_ARG_VALUE('options.encoding', encoding);
validateBoolean(objectMode, 'options.objectMode');
const reader = readableStream.getReader();
@ -686,7 +686,7 @@ function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options =
validateBoolean(objectMode, 'options.objectMode');
if (encoding !== undefined && !Buffer.isEncoding(encoding))
throw new ERR_INVALID_ARG_VALUE(encoding, 'options.encoding');
throw new ERR_INVALID_ARG_VALUE('options.encoding', encoding);
const writer = writableStream.getWriter();
const reader = readableStream.getReader();