From 13e7a261f7b99f7d77f4eaf686f688019bb48e7e Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Mar 2020 14:56:58 -0700 Subject: [PATCH 1/2] fs: fixup error message for invalid options.recursive Use "options.recursive" instead of just "recursive" Signed-off-by: James M Snell --- lib/fs.js | 4 ++-- test/parallel/test-fs-mkdir.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 7a3480a0eca9a8..81bfaee1fd59a6 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -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; @@ -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), diff --git a/test/parallel/test-fs-mkdir.js b/test/parallel/test-fs-mkdir.js index add0926f8379f6..5e28d6b944b6e0 100644 --- a/test/parallel/test-fs-mkdir.js +++ b/test/parallel/test-fs-mkdir.js @@ -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 } ); @@ -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 } ); From 7ad44d55a5193f77b004a66e30e16a7ee7b85d0d Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Mar 2020 15:23:49 -0700 Subject: [PATCH 2/2] fixup! doc: improve wording in vm.md --- lib/internal/fs/promises.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index 12cca60ae30de2..e75a7bc19111c4 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -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,