about summary refs log tree commit diff
path: root/corp/tvixbolt/src
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-12T13·18+0300
committertazjin <tazjin@tvl.su>2022-09-13T14·41+0000
commita9914a79a0e55741efc7f8b6d694c043248abf2c (patch)
treed61cad958a9c99396c5e5cc810249a7e9efea6cf /corp/tvixbolt/src
parent0f59fe66015580612ee79a9e9e985eaa0fa495e6 (diff)
feat(corp/tvixbolt): use fancy error formatting r/4837
Change-Id: I633154f3a2ae2b1789992a1137c944e897c56b2c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6535
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'corp/tvixbolt/src')
-rw-r--r--corp/tvixbolt/src/main.rs13
1 files changed, 8 insertions, 5 deletions
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