From 13493d9121da9f253cd601c18d2443e29e67dd29 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Sat, 11 Feb 2023 15:36:29 +0000 Subject: fix(cli/graph_util): don't append referrer info for root module errors (#17730) --- cli/graph_util.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cli/graph_util.rs') diff --git a/cli/graph_util.rs b/cli/graph_util.rs index e667714d6..3fa849a71 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -57,6 +57,10 @@ pub fn graph_valid( walk_options: deno_graph::WalkOptions, ) -> Result<(), AnyError> { graph.walk(roots, walk_options).validate().map_err(|error| { + let is_root = match &error { + ModuleGraphError::ResolutionError(_) => false, + _ => roots.contains(error.specifier()), + }; let mut message = if let ModuleGraphError::ResolutionError(err) = &error { enhanced_resolution_error_message(err) } else { @@ -64,7 +68,7 @@ pub fn graph_valid( }; if let Some(range) = error.maybe_range() { - if !range.specifier.as_str().contains("/$deno$eval") { + if !is_root && !range.specifier.as_str().contains("/$deno$eval") { message.push_str(&format!("\n at {range}")); } } -- cgit v1.2.3