diff options
Diffstat (limited to 'tvix/eval/src/vm/generators.rs')
-rw-r--r-- | tvix/eval/src/vm/generators.rs | 8 |
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 |