WICG/import-maps

Throwing TypeError in resolve a module specifier?

allstarschh opened this issue · 2 comments

According to the import maps spec, resolve a module specifier will throw,
https://wicg.github.io/import-maps/#resolve-a-module-specifier, step 12

Also the callers will be updated as well, according to https://wicg.github.io/import-maps/#resolving-updates

But what about https://html.spec.whatwg.org/multipage/webappapis.html#validate-requested-module-specifiers
According to the HTML spec, the error should be propagated to the script's parse error
https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-parse-error

and later it will be the error to rethrow object of the script.
https://html.spec.whatwg.org/multipage/webappapis.html#concept-script-error-to-rethrow

So in this case, should 'resolve a module specifier' still throw a TypeError if it has any?
Or it should return failure (like the original 'resolve a module specifier' does), and let script to propagate the error?

Note: V8's implementation is in
JSModuleScript::Create
ModulatorImplBase::ResolveModuleSpecifier
and
ImportMap::Resolve

Yes, you're right that the propagation is a bit more complex for that caller. My plan was to convert it to catch the error and store it.

I believe this is fixed in whatwg/html#8075. Please check. If so, I will close this when I remove all spec text from this repository and instead let HTML be the new source of truth.