Skip to content

Commit

Permalink
fixup! fixup! esm: improve error when calling import.meta.resolve f…
Browse files Browse the repository at this point in the history
…rom `data:` URL
  • Loading branch information
aduh95 committed Sep 12, 2023
1 parent 015b5b6 commit 83a253e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url, supported) => {
return msg;
}, Error);
E('ERR_UNSUPPORTED_RESOLVE_REQUEST',
'Failed to resolve module specifier "%s": Invalid relative url or base scheme is not hierarchical.',
'Failed to resolve module specifier "%s" from "%s": Invalid relative url or base scheme is not hierarchical.',
TypeError);
E('ERR_USE_AFTER_CLOSE', '%s was closed', Error);

Expand Down
4 changes: 2 additions & 2 deletions lib/internal/modules/esm/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
try {
resolved = new URL(specifier, base);
} catch (cause) {
const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier);
const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
setOwnProperty(error, 'cause', cause);
throw error;
}
Expand All @@ -839,7 +839,7 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
resolved = new URL(specifier);
} catch (cause) {
if (isRemote && !BuiltinModule.canBeRequiredWithoutScheme(specifier)) {
const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier);
const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
setOwnProperty(error, 'cause', cause);
throw error;
}
Expand Down

0 comments on commit 83a253e

Please sign in to comment.