diff --git a/lib/path.js b/lib/path.js index 625b6261042940..1a2b3e38eca03f 100644 --- a/lib/path.js +++ b/lib/path.js @@ -168,7 +168,7 @@ const win32 = { let path; if (i >= 0) { path = args[i]; - validateString(path, 'path'); + validateString(path, `paths[${i}]`); // Skip empty entries if (path.length === 0) { @@ -1098,8 +1098,7 @@ const posix = { for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { const path = i >= 0 ? args[i] : posixCwd(); - - validateString(path, 'path'); + validateString(path, `paths[${i}]`); // Skip empty entries if (path.length === 0) {