Skip to content

Commit

Permalink
lib: fixup more incorrect ERR_INVALID_ARG_VALUE uses
Browse files Browse the repository at this point in the history
PR-URL: #57177
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
jasnell authored and nodejs-github-bot committed Feb 24, 2025
1 parent e287009 commit 85c0f7a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/internal/fs/recursive_watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/fs/watchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/quic/quic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/internal/webstreams/adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 85c0f7a

Please sign in to comment.