fix(tvix/eval): catchable-aware throw

`throw (throw "a")` should work and propagate the internal throw.
Before this commit, it didn't work.

Change-Id: Id5d46f74e484dba99e912ad9fa211f3bf1617bac
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10600
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Ryan Lahfa 2024-01-10 23:43:28 +01:00 committed by raitobezarius
parent e5e33611d7
commit 44d24852c3

View file

@ -1484,6 +1484,10 @@ mod pure_builtins {
#[builtin("throw")]
async fn builtin_throw(co: GenCo, message: Value) -> Result<Value, ErrorKind> {
// If it's already some error, let's propagate it immediately.
if message.is_catchable() {
return Ok(message);
}
// TODO(sterni): coerces to string
// We do not care about the context here explicitly.
Ok(Value::Catchable(CatchableErrorKind::Throw(