Skip to content

Commit 85c0f7a

Browse files
jasnellnodejs-github-bot
authored andcommitted
lib: fixup more incorrect ERR_INVALID_ARG_VALUE uses
PR-URL: #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>
1 parent e287009 commit 85c0f7a

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lib/internal/fs/recursive_watch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class FSWatcher extends EventEmitter {
6868
if (encoding != null) {
6969
// This is required since on macOS and Windows it throws ERR_INVALID_ARG_VALUE
7070
if (typeof encoding !== 'string') {
71-
throw new ERR_INVALID_ARG_VALUE(encoding, 'options.encoding');
71+
throw new ERR_INVALID_ARG_VALUE('options.encoding', encoding);
7272
}
7373
}
7474

lib/internal/fs/watchers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ async function* watch(filename, options = kEmptyObject) {
318318

319319
if (encoding && !isEncoding(encoding)) {
320320
const reason = 'is invalid encoding';
321-
throw new ERR_INVALID_ARG_VALUE(encoding, 'encoding', reason);
321+
throw new ERR_INVALID_ARG_VALUE('encoding', encoding, reason);
322322
}
323323

324324
if (signal?.aborted)

lib/internal/quic/quic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,7 @@ function processSessionOptions(options, forServer = false) {
20692069
if (cc !== undefined) {
20702070
validateString(cc, 'options.cc');
20712071
if (cc !== 'reno' || cc !== 'bbr' || cc !== 'cubic') {
2072-
throw new ERR_INVALID_ARG_VALUE(cc, 'options.cc');
2072+
throw new ERR_INVALID_ARG_VALUE('options.cc', cc);
20732073
}
20742074
}
20752075

lib/internal/webstreams/adapters.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ function newStreamReadableFromReadableStream(readableStream, options = kEmptyObj
529529
} = options;
530530

531531
if (encoding !== undefined && !Buffer.isEncoding(encoding))
532-
throw new ERR_INVALID_ARG_VALUE(encoding, 'options.encoding');
532+
throw new ERR_INVALID_ARG_VALUE('options.encoding', encoding);
533533
validateBoolean(objectMode, 'options.objectMode');
534534

535535
const reader = readableStream.getReader();
@@ -686,7 +686,7 @@ function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options =
686686

687687
validateBoolean(objectMode, 'options.objectMode');
688688
if (encoding !== undefined && !Buffer.isEncoding(encoding))
689-
throw new ERR_INVALID_ARG_VALUE(encoding, 'options.encoding');
689+
throw new ERR_INVALID_ARG_VALUE('options.encoding', encoding);
690690

691691
const writer = writableStream.getWriter();
692692
const reader = readableStream.getReader();

0 commit comments

Comments
 (0)