diff options
Diffstat (limited to 'tvix/eval/src/eval.rs')
-rw-r--r-- | tvix/eval/src/eval.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tvix/eval/src/eval.rs b/tvix/eval/src/eval.rs index 21591802a443..e6199e00b0e2 100644 --- a/tvix/eval/src/eval.rs +++ b/tvix/eval/src/eval.rs @@ -81,21 +81,22 @@ pub fn interpret(code: &str, location: Option<PathBuf>, options: Options) -> Eva } for error in &result.errors { - eprintln!( - "compiler error: {:?} at `{}`[line {}]", - error.kind, - file.source_slice(error.span), - file.find_line(error.span.low()) + 1 - ); + error.fancy_format_stderr(&codemap); } if let Some(err) = result.errors.last() { return Err(err.clone()); } - if options.trace_runtime { + let result = if options.trace_runtime { crate::vm::run_lambda(&mut TracingObserver::new(std::io::stderr()), result.lambda) } else { crate::vm::run_lambda(&mut NoOpObserver::default(), result.lambda) + }; + + if let Err(err) = &result { + err.fancy_format_stderr(&codemap); } + + result } |