Skip to content

Commit

Permalink
esm: shorten ERR_UNSUPPORTED_ESM_URL_SCHEME message
Browse files Browse the repository at this point in the history
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 <guybedford@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
  • Loading branch information
Trott authored and codebytere committed Oct 1, 2020
1 parent 551be2a commit 9159649
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1404,8 +1404,8 @@ E('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " +
E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url) => {
let msg = 'Only file and data URLs are supported by the default ESM loader';
if (isWindows && url.protocol.length === 2) {
msg += '. Absolute Windows paths without prefix are not valid URLs, ' +
"consider using 'file://' prefix";
msg +=
'. On Windows, absolute paths must be valid file:// URLs';
}
msg += `. Received protocol '${url.protocol}'`;
return msg;
Expand Down
4 changes: 2 additions & 2 deletions test/es-module/test-esm-dynamic-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ function expectFsNamespace(result) {
if (common.isWindows) {
const msg =
'Only file and data URLs are supported by the default ESM loader. ' +
'Absolute Windows paths without prefix are not valid URLs, ' +
"consider using 'file://' prefix. Received protocol 'c:'";
'On Windows, absolute paths must be valid file:// URLs. ' +
"Received protocol 'c:'";
expectModuleError(import('C:\\example\\foo.mjs'),
'ERR_UNSUPPORTED_ESM_URL_SCHEME',
msg);
Expand Down

0 comments on commit 9159649

Please sign in to comment.