Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,12 @@ E('ERR_IMPORT_ATTRIBUTE_MISSING',
E('ERR_IMPORT_ATTRIBUTE_TYPE_INCOMPATIBLE',
'Module "%s" is not of type "%s"', TypeError);
E('ERR_IMPORT_ATTRIBUTE_UNSUPPORTED',
'Import attribute "%s" with value "%s" is not supported', TypeError);
function error(attribute, value, url = undefined) {
if (url === undefined) {
return `Import attribute "${attribute}" with value "${value}" is not supported`;
}
return `Import attribute "${attribute}" with value "${value}" is not supported in ${url}`;
}, TypeError);
E('ERR_INCOMPATIBLE_OPTION_PAIR',
'Option "%s" cannot be used in combination with option "%s"', TypeError, HideStackFramesError);
E('ERR_INPUT_TYPE_NOT_ALLOWED', '--input-type can only be used with string ' +
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/modules/esm/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function validateAttributes(url, format,
const keys = ObjectKeys(importAttributes);
for (let i = 0; i < keys.length; i++) {
if (keys[i] !== 'type') {
throw new ERR_IMPORT_ATTRIBUTE_UNSUPPORTED(keys[i], importAttributes[keys[i]]);
throw new ERR_IMPORT_ATTRIBUTE_UNSUPPORTED(keys[i], importAttributes[keys[i]], url);
}
}
const validType = formatTypeMap[format];
Expand Down Expand Up @@ -102,7 +102,7 @@ function handleInvalidType(url, type) {

// `type` might not have been one of the types we understand.
if (!ArrayPrototypeIncludes(supportedTypeAttributes, type)) {
throw new ERR_IMPORT_ATTRIBUTE_UNSUPPORTED('type', type);
throw new ERR_IMPORT_ATTRIBUTE_UNSUPPORTED('type', type, url);
}

// `type` was the wrong value for this format.
Expand Down
Loading