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 <tazjin@tvl.su>
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Vincent Ambo 2024-02-20 18:09:12 +07:00 committed by clbot
parent d9565a4d0a
commit 20833656ae
3 changed files with 46 additions and 6 deletions

View file

@ -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) => {