From 8770fd96a7288e2d603c028683c15344b7563994 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 24 Mar 2020 14:56:58 -0700 Subject: [PATCH] fs: fixup error message for invalid options.recursive Use "options.recursive" instead of just "recursive" Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/32472 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- lib/fs.js | 4 ++-- lib/internal/fs/promises.js | 2 +- test/parallel/test-fs-mkdir.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 033c25cda948d6..d48bd523cc3e68 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -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; @@ -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), diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index b29aace4a5b464..a7192c4848855b 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -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, 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 } );