mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
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:
parent
e28700930d
commit
85c0f7aef3
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user