From a9914a79a0e55741efc7f8b6d694c043248abf2c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 12 Sep 2022 16:18:26 +0300 Subject: feat(corp/tvixbolt): use fancy error formatting Change-Id: I633154f3a2ae2b1789992a1137c944e897c56b2c Reviewed-on: https://cl.tvl.fyi/c/depot/+/6535 Reviewed-by: grfn Tested-by: BuildkiteCI --- corp/tvixbolt/src/main.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'corp/tvixbolt/src') diff --git a/corp/tvixbolt/src/main.rs b/corp/tvixbolt/src/main.rs index f36d264d555e..35e9d27921f9 100644 --- a/corp/tvixbolt/src/main.rs +++ b/corp/tvixbolt/src/main.rs @@ -267,10 +267,8 @@ fn eval(trace: bool, code: &str) -> Output { for error in &result.errors { writeln!( &mut out.compiler_errors, - "error: {:?} at `{}` [line {}]", - error.kind, - file.source_slice(error.span), - file.find_line(error.span.low()) + 1 + "{}\n", + error.fancy_format_str(&codemap).trim(), ) .unwrap(); } @@ -286,7 +284,12 @@ fn eval(trace: bool, code: &str) -> Output { match result { Ok(value) => writeln!(&mut out.output, "{}", value).unwrap(), - Err(err) => writeln!(&mut out.runtime_errors, "runtime error: {:?}", err).unwrap(), + Err(err) => writeln!( + &mut out.runtime_errors, + "{}", + err.fancy_format_str(&codemap).trim() + ) + .unwrap(), }; out -- cgit 1.4.1