Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: fixup error message for invalid options.recursive #32472

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,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 @@ -884,7 +884,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 @@ -345,7 +345,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),
parseFileMode(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