import_map icon indicating copy to clipboard operation
import_map copied to clipboard

feat: add path to ImportMapError::UnmappedBareSpecifier

Open cscheid opened this issue 1 year ago • 4 comments

This improves the error message emitted in the case of an unmapped specifier, specifically adding the path of the relevant import map.

Having the path information right there would have saved me a good bit of time to have realized that something was interfering with the import map specification, and so I hope this is useful for other folks as well.

This change requires one small update to denoland/deno, in cli/graph_util.rs:735 specifically. I hope that's acceptable (or if there's a better way to do this, I'd be happy to change the PR).

cscheid avatar Feb 28 '24 01:02 cscheid

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Feb 28 '24 01:02 CLAassistant

@dsherret could you take a look?

lino-levan avatar Feb 28 '24 01:02 lino-levan

Yes, I'd be happy to do it.

Just so I know what to target, what do you folks usually expect out of such tests? For example, the original tuple didn't appear to have any test or code path corresponding to an empty referrer.

cscheid avatar Feb 28 '24 14:02 cscheid

Just so I know what to target, what do you folks usually expect out of such tests? For example, the original tuple didn't appear to have any test or code path corresponding to an empty referrer.

Just one test like this one that calls .to_string() on the error when maybe_path is set would be great: https://github.com/denoland/import_map/blob/de119206ade83aa5eddf4afb1c388e42847781e9/rs-lib/tests/integration_test.rs#L245-L250

Thanks!

dsherret avatar Feb 28 '24 14:02 dsherret