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:
parent
e5e33611d7
commit
44d24852c3
1 changed files with 4 additions and 0 deletions
|
@ -1484,6 +1484,10 @@ mod pure_builtins {
|
||||||
|
|
||||||
#[builtin("throw")]
|
#[builtin("throw")]
|
||||||
async fn builtin_throw(co: GenCo, message: Value) -> Result<Value, ErrorKind> {
|
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
|
// TODO(sterni): coerces to string
|
||||||
// We do not care about the context here explicitly.
|
// We do not care about the context here explicitly.
|
||||||
Ok(Value::Catchable(CatchableErrorKind::Throw(
|
Ok(Value::Catchable(CatchableErrorKind::Throw(
|
||||||
|
|
Loading…
Reference in a new issue