From 1200f69082b41ce185b0407aff12fde593eadfee Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 11 Jul 2024 16:32:52 -0400 Subject: [PATCH] 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. --- ext/node/resolution.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/node/resolution.rs b/ext/node/resolution.rs index c94b55f542..84d8ba39dd 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() {