feat(corp/tvixbolt): use fancy error formatting

Change-Id: I633154f3a2ae2b1789992a1137c944e897c56b2c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6535
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-09-12 16:18:26 +03:00 committed by tazjin
parent 0f59fe6601
commit a9914a79a0

View file

@ -267,10 +267,8 @@ fn eval(trace: bool, code: &str) -> Output {
for error in &result.errors { for error in &result.errors {
writeln!( writeln!(
&mut out.compiler_errors, &mut out.compiler_errors,
"error: {:?} at `{}` [line {}]", "{}\n",
error.kind, error.fancy_format_str(&codemap).trim(),
file.source_slice(error.span),
file.find_line(error.span.low()) + 1
) )
.unwrap(); .unwrap();
} }
@ -286,7 +284,12 @@ fn eval(trace: bool, code: &str) -> Output {
match result { match result {
Ok(value) => writeln!(&mut out.output, "{}", value).unwrap(), 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 out