Skip to content

Commit b85bc0c

Browse files
jasnelltargos
authored andcommittedApr 22, 2020
fs: fixup error message for invalid options.recursive
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>
1 parent ad347f4 commit b85bc0c

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
@@ -813,7 +813,7 @@ function mkdir(path, options, callback) {
813813
path = getValidatedPath(path);
814814

815815
if (typeof recursive !== 'boolean')
816-
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive);
816+
throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive);
817817

818818
const req = new FSReqCallback();
819819
req.oncomplete = callback;
@@ -832,7 +832,7 @@ function mkdirSync(path, options) {
832832

833833
path = getValidatedPath(path);
834834
if (typeof recursive !== 'boolean')
835-
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive);
835+
throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive);
836836

837837
const ctx = { path };
838838
binding.mkdir(pathModule.toNamespacedPath(path),

‎lib/internal/fs/promises.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ async function mkdir(path, options) {
333333
} = options || {};
334334
path = getValidatedPath(path);
335335
if (typeof recursive !== 'boolean')
336-
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', recursive);
336+
throw new ERR_INVALID_ARG_TYPE('options.recursive', 'boolean', recursive);
337337

338338
return binding.mkdir(pathModule.toNamespacedPath(path),
339339
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)
Please sign in to comment.