about summary refs log tree commit diff
path: root/tvix/eval/src/vm/generators.rs
diff options
context:
space:
mode:
authorRyan Lahfa <tvl@lahfa.xyz>2023-12-30T02·21+0100
committerraitobezarius <tvl@lahfa.xyz>2024-01-14T03·37+0000
commit2750e1e640f5228afe1efcdb4deb4922887d0121 (patch)
tree1dccb67909d8a951ec49f5302ff1b5ad6e9fd11d /tvix/eval/src/vm/generators.rs
parent37cc88897e0c6baa9835b49842e723f9e7006f5f (diff)
fix(tvix/eval): catchable-aware builtins r/7379
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>
Diffstat (limited to 'tvix/eval/src/vm/generators.rs')
-rw-r--r--tvix/eval/src/vm/generators.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/tvix/eval/src/vm/generators.rs b/tvix/eval/src/vm/generators.rs
index bbf79f47c05d..f2ce73a0c742 100644
--- a/tvix/eval/src/vm/generators.rs
+++ b/tvix/eval/src/vm/generators.rs
@@ -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