summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-07-11 16:32:52 -0400
committerGitHub <noreply@github.com>2024-07-11 16:32:52 -0400
commit1200f69082b41ce185b0407aff12fde593eadfee (patch)
treedffe669bc08312fd80f8eb119cb05a581db9af5d
parent3d0e1b65b1e1a754f6440fff1df873da8b2144a1 (diff)
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.
-rw-r--r--ext/node/resolution.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/node/resolution.rs b/ext/node/resolution.rs
index c94b55f54..84d8ba39d 100644
--- a/ext/node/resolution.rs
+++ b/ext/node/resolution.rs
@@ -878,15 +878,15 @@ impl NodeResolver {
last_error = None;
continue;
}
- Err(e) => match e.as_kind() {
- PackageTargetResolveErrorKind::InvalidPackageTarget(_) => {
+ Err(e) => {
+ // 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);
continue;
- }
- _ => {
+ } else {
return Err(e);
}
- },
+ }
}
}
if last_error.is_none() {