From 20833656aee4aaefdd83e7beb141a5e03f8c956d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 20 Feb 2024 18:09:12 +0700 Subject: fix(tvix/eval): propagate catchable errors at the top of an eval (Re-)Adds an error variant that wraps a catchable error kind, which is used for returning the result of an evaluation. Previously this would return the internal catchable value, which would lead to panics if users tried to use these. Somehow this was missed; I think we need error output tests. Change-Id: Id6e24aa2ce4ea4358a29b2e1cf4a6749986baf8c Reviewed-on: https://cl.tvl.fyi/c/depot/+/10991 Tested-by: BuildkiteCI Autosubmit: tazjin Reviewed-by: flokli --- tvix/eval/src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tvix/eval/src/lib.rs') diff --git a/tvix/eval/src/lib.rs b/tvix/eval/src/lib.rs index 8ce37de42732..845964cb7e00 100644 --- a/tvix/eval/src/lib.rs +++ b/tvix/eval/src/lib.rs @@ -301,7 +301,7 @@ where nix_path, self.io_handle, runtime_observer, - source, + source.clone(), globals, lambda, self.strict, @@ -310,6 +310,15 @@ where match vm_result { Ok(mut runtime_result) => { result.warnings.append(&mut runtime_result.warnings); + if let Value::Catchable(inner) = runtime_result.value { + result.errors.push(Error::new( + ErrorKind::CatchableError(*inner), + file.span, + source, + )); + return result; + } + result.value = Some(runtime_result.value); } Err(err) => { -- cgit 1.4.1