1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix(node): revert invalid package target change (#24539)

Reason is that `e` may contain an invalid package target nested deeply
in the returned errors. We should probably add a `.code()` to all errors
to make matching easier or make the errors flatter.
This commit is contained in:
David Sherret 2024-07-11 16:32:52 -04:00 committed by GitHub
parent 3d0e1b65b1
commit 1200f69082
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -878,15 +878,15 @@ impl NodeResolver {
last_error = None; last_error = None;
continue; continue;
} }
Err(e) => match e.as_kind() { Err(e) => {
PackageTargetResolveErrorKind::InvalidPackageTarget(_) => { // todo(dsherret): add codes to each error and match on that instead
if e.to_string().starts_with("[ERR_INVALID_PACKAGE_TARGET]") {
last_error = Some(e); last_error = Some(e);
continue; continue;
} } else {
_ => {
return Err(e); return Err(e);
} }
}, }
} }
} }
if last_error.is_none() { if last_error.is_none() {