Skip to content

Commit

Permalink
fix(cli): add colors to "Module not found" error frame (denoland#18437)
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Mar 26, 2023
1 parent a29d88b commit 355275e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cli/graph_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ pub fn graph_valid(

if let Some(range) = error.maybe_range() {
if !is_root && !range.specifier.as_str().contains("/$deno$eval") {
message.push_str(&format!("\n at {range}"));
message.push_str(&format!(
"\n at {}:{}:{}",
colors::cyan(range.specifier.as_str()),
colors::yellow(&(range.start.line + 1).to_string()),
colors::yellow(&(range.start.character + 1).to_string())
));
}
}

Expand Down
2 changes: 1 addition & 1 deletion cli/tools/vendor/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ mod test {
.unwrap();

assert_eq!(
err.to_string(),
test_util::strip_ansi_codes(&err.to_string()),
concat!(
"500 Internal Server Error\n",
" at https://localhost/mod.ts:1:14"
Expand Down

0 comments on commit 355275e

Please sign in to comment.