Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Bedford <guybedford@gmail.com>2020-08-10 02:54:01 +0300
committerGuy Bedford <guybedford@gmail.com>2020-08-13 21:04:24 +0300
commitf8976a76bbb49d678056d6d2ddd57064cf9e63c2 (patch)
tree864e198c4ac8ab2cffb21cad70d09b77025abdc0 /lib/internal/errors.js
parent56b25e7a6f741c8181c55f3d40d0cab6ffa1eb4d (diff)
module: share CJS/ESM resolver fns, refactoring
PR-URL: https://github.com/nodejs/node/pull/34744 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/errors.js')
-rw-r--r--lib/internal/errors.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
index a9c69eda7b0..d8e2e58333c 100644
--- a/lib/internal/errors.js
+++ b/lib/internal/errors.js
@@ -26,8 +26,6 @@ const {
WeakMap,
} = primordials;
-const sep = process.platform === 'win32' ? '\\' : '/';
-
const messages = new Map();
const codes = {};
@@ -1120,10 +1118,9 @@ E('ERR_INVALID_OPT_VALUE', (name, value) =>
RangeError);
E('ERR_INVALID_OPT_VALUE_ENCODING',
'The value "%s" is invalid for option "encoding"', TypeError);
-E('ERR_INVALID_PACKAGE_CONFIG', (path, message, hasMessage = true) => {
- if (hasMessage)
- return `Invalid package config ${path}${sep}package.json, ${message}`;
- return `Invalid JSON in ${path} imported from ${message}`;
+E('ERR_INVALID_PACKAGE_CONFIG', (path, base, message) => {
+ return `Invalid package config ${path}${base ? ` imported from ${base}` :
+ ''}${message ? `. ${message}` : ''}`;
}, Error);
E('ERR_INVALID_PACKAGE_TARGET',
(pkgPath, key, target, isImport = false, base = undefined) => {