Skip to content

Commit 9159649

Browse files
Trottcodebytere
authored andcommitted
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: #34836 Backport-PR-URL: #35385 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Denys Otrishko <[email protected]>
1 parent 551be2a commit 9159649

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/internal/errors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,8 +1404,8 @@ E('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " +
14041404
E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url) => {
14051405
let msg = 'Only file and data URLs are supported by the default ESM loader';
14061406
if (isWindows && url.protocol.length === 2) {
1407-
msg += '. Absolute Windows paths without prefix are not valid URLs, ' +
1408-
"consider using 'file://' prefix";
1407+
msg +=
1408+
'. On Windows, absolute paths must be valid file:// URLs';
14091409
}
14101410
msg += `. Received protocol '${url.protocol}'`;
14111411
return msg;

test/es-module/test-esm-dynamic-import.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ function expectFsNamespace(result) {
6262
if (common.isWindows) {
6363
const msg =
6464
'Only file and data URLs are supported by the default ESM loader. ' +
65-
'Absolute Windows paths without prefix are not valid URLs, ' +
66-
"consider using 'file://' prefix. Received protocol 'c:'";
65+
'On Windows, absolute paths must be valid file:// URLs. ' +
66+
"Received protocol 'c:'";
6767
expectModuleError(import('C:\\example\\foo.mjs'),
6868
'ERR_UNSUPPORTED_ESM_URL_SCHEME',
6969
msg);

0 commit comments

Comments
 (0)