summaryrefslogtreecommitdiff
path: root/cli/graph_util.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-02-11 15:36:29 +0000
committerGitHub <noreply@github.com>2023-02-11 10:36:29 -0500
commit13493d9121da9f253cd601c18d2443e29e67dd29 (patch)
treeb313bd2b9aa45b94e4819114c5096aa5635cac44 /cli/graph_util.rs
parenta55f0eb2fc005016dc9d44bfe4771dd451df9c30 (diff)
fix(cli/graph_util): don't append referrer info for root module errors (#17730)
Diffstat (limited to 'cli/graph_util.rs')
-rw-r--r--cli/graph_util.rs6
1 files changed, 5 insertions, 1 deletions
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}"));
}
}