fix(tvix/eval): catchable-aware builtins

A bunch of operations in Tvix are not aware of catchable values
and does not propagate them.

In the meantime, as we wait for a better solution, we just offer this
commit for moving the needle.

Change-Id: Ic3f0e1550126b0847b597dfc1402c35e0eeef469
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10473
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Ryan Lahfa 2023-12-30 03:21:45 +01:00 committed by raitobezarius
parent 37cc88897e
commit 2750e1e640
6 changed files with 328 additions and 41 deletions

View file

@ -763,9 +763,13 @@ pub(crate) async fn request_span(co: &GenCo) -> LightSpan {
}
}
pub(crate) async fn request_to_json(co: &GenCo, value: Value) -> serde_json::Value {
pub(crate) async fn request_to_json(
co: &GenCo,
value: Value,
) -> Result<serde_json::Value, CatchableErrorKind> {
match co.yield_(VMRequest::ToJson(value)).await {
VMResponse::Value(Value::Json(json)) => json,
VMResponse::Value(Value::Json(json)) => Ok(json),
VMResponse::Value(Value::Catchable(cek)) => Err(cek),
msg => panic!(
"Tvix bug: VM responded with incorrect generator message: {}",
msg