Skip to content

Commit 8770fd9

Browse files
jasnelladdaleax
authored andcommitted
fs: fixup error message for invalid options.recursive
Use "options.recursive" instead of just "recursive" Signed-off-by: James M Snell <[email protected]> PR-URL: #32472 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 1de9718 commit 8770fd9

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/fs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ function mkdir(path, options, callback) {
859859
path = getValidatedPath(path);
860860

861861
if (typeof recursive !== 'boolean')
862-
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive);
862+
throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive);
863863

864864
const req = new FSReqCallback();
865865
req.oncomplete = callback;
@@ -878,7 +878,7 @@ function mkdirSync(path, options) {
878878

879879
path = getValidatedPath(path);
880880
if (typeof recursive !== 'boolean')
881-
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive);
881+
throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive);
882882

883883
const ctx = { path };
884884
const result = binding.mkdir(pathModule.toNamespacedPath(path),

lib/internal/fs/promises.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ async function mkdir(path, options) {
346346
} = options || {};
347347
path = getValidatedPath(path);
348348
if (typeof recursive !== 'boolean')
349-
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive);
349+
throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive);
350350

351351
return binding.mkdir(pathModule.toNamespacedPath(path),
352352
parseMode(mode, 'mode', 0o777), recursive,

test/parallel/test-fs-mkdir.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ if (common.isMainThread && (common.isLinux || common.isOSX)) {
229229
{
230230
code: 'ERR_INVALID_ARG_TYPE',
231231
name: 'TypeError',
232-
message: 'The "recursive" argument must be of type boolean.' +
232+
message: 'The "options.recursive" property must be of type boolean.' +
233233
received
234234
}
235235
);
@@ -238,7 +238,7 @@ if (common.isMainThread && (common.isLinux || common.isOSX)) {
238238
{
239239
code: 'ERR_INVALID_ARG_TYPE',
240240
name: 'TypeError',
241-
message: 'The "recursive" argument must be of type boolean.' +
241+
message: 'The "options.recursive" property must be of type boolean.' +
242242
received
243243
}
244244
);

0 commit comments

Comments
 (0)