Skip to content

Commit

Permalink
fs: fixup error message for invalid options.recursive
Browse files Browse the repository at this point in the history
Use "options.recursive" instead of just "recursive"

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #32472
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
jasnell authored and addaleax committed Mar 30, 2020
1 parent 1de9718 commit 8770fd9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ function mkdir(path, options, callback) {
path = getValidatedPath(path);

if (typeof recursive !== 'boolean')
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive);
throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive);

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

path = getValidatedPath(path);
if (typeof recursive !== 'boolean')
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive);
throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive);

const ctx = { path };
const result = binding.mkdir(pathModule.toNamespacedPath(path),
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/fs/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ async function mkdir(path, options) {
} = options || {};
path = getValidatedPath(path);
if (typeof recursive !== 'boolean')
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive);
throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive);

return binding.mkdir(pathModule.toNamespacedPath(path),
parseMode(mode, 'mode', 0o777), recursive,
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-fs-mkdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ if (common.isMainThread && (common.isLinux || common.isOSX)) {
{
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError',
message: 'The "recursive" argument must be of type boolean.' +
message: 'The "options.recursive" property must be of type boolean.' +
received
}
);
Expand All @@ -238,7 +238,7 @@ if (common.isMainThread && (common.isLinux || common.isOSX)) {
{
code: 'ERR_INVALID_ARG_TYPE',
name: 'TypeError',
message: 'The "recursive" argument must be of type boolean.' +
message: 'The "options.recursive" property must be of type boolean.' +
received
}
);
Expand Down

0 comments on commit 8770fd9

Please sign in to comment.