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 targos committed Apr 22, 2020
1 parent ad347f4 commit b85bc0c
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 @@ -813,7 +813,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 @@ -832,7 +832,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 };
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 @@ -333,7 +333,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 b85bc0c

Please sign in to comment.