mirror of https://github.com/nodejs/node.git
esm: shorten ERR_UNSUPPORTED_ESM_URL_SCHEME message
I know it just got modified to include new information, but this shortens the message a bit without (I hope) losing clarity or meaning. PR-URL: https://github.com/nodejs/node/pull/34836 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
This commit is contained in:
parent
c1ef122e98
commit
e1edd6bbfa
|
@ -1434,8 +1434,8 @@ E('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " +
|
||||||
E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url) => {
|
E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url) => {
|
||||||
let msg = 'Only file and data URLs are supported by the default ESM loader';
|
let msg = 'Only file and data URLs are supported by the default ESM loader';
|
||||||
if (isWindows && url.protocol.length === 2) {
|
if (isWindows && url.protocol.length === 2) {
|
||||||
msg += '. Absolute Windows paths without prefix are not valid URLs, ' +
|
msg +=
|
||||||
"consider using 'file://' prefix";
|
'. On Windows, absolute paths must be valid file:// URLs';
|
||||||
}
|
}
|
||||||
msg += `. Received protocol '${url.protocol}'`;
|
msg += `. Received protocol '${url.protocol}'`;
|
||||||
return msg;
|
return msg;
|
||||||
|
|
|
@ -59,8 +59,8 @@ function expectFsNamespace(result) {
|
||||||
if (common.isWindows) {
|
if (common.isWindows) {
|
||||||
const msg =
|
const msg =
|
||||||
'Only file and data URLs are supported by the default ESM loader. ' +
|
'Only file and data URLs are supported by the default ESM loader. ' +
|
||||||
'Absolute Windows paths without prefix are not valid URLs, ' +
|
'On Windows, absolute paths must be valid file:// URLs. ' +
|
||||||
"consider using 'file://' prefix. Received protocol 'c:'";
|
"Received protocol 'c:'";
|
||||||
expectModuleError(import('C:\\example\\foo.mjs'),
|
expectModuleError(import('C:\\example\\foo.mjs'),
|
||||||
'ERR_UNSUPPORTED_ESM_URL_SCHEME',
|
'ERR_UNSUPPORTED_ESM_URL_SCHEME',
|
||||||
msg);
|
msg);
|
||||||
|
|
Loading…
Reference in New Issue