Skip to content

Commit db8c66b

Browse files
Trottrichardlau
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 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Denys Otrishko <[email protected]>
1 parent f537c86 commit db8c66b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/internal/errors.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1415,8 +1415,8 @@ E('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " +
14151415
E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url) => {
14161416
let msg = 'Only file and data URLs are supported by the default ESM loader';
14171417
if (isWindows && url.protocol.length === 2) {
1418-
msg += '. Absolute Windows paths without prefix are not valid URLs, ' +
1419-
"consider using 'file://' prefix";
1418+
msg +=
1419+
'. On Windows, absolute paths must be valid file:// URLs';
14201420
}
14211421
msg += `. Received protocol '${url.protocol}'`;
14221422
return msg;

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ function expectFsNamespace(result) {
5959
if (common.isWindows) {
6060
const msg =
6161
'Only file and data URLs are supported by the default ESM loader. ' +
62-
'Absolute Windows paths without prefix are not valid URLs, ' +
63-
"consider using 'file://' prefix. Received protocol 'c:'";
62+
'On Windows, absolute paths must be valid file:// URLs. ' +
63+
"Received protocol 'c:'";
6464
expectModuleError(import('C:\\example\\foo.mjs'),
6565
'ERR_UNSUPPORTED_ESM_URL_SCHEME',
6666
msg);

0 commit comments

Comments
 (0)