about summary refs log tree commit diff
path: root/tvix/eval/src/value
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/value')
-rw-r--r--tvix/eval/src/value/json.rs12
-rw-r--r--tvix/eval/src/value/mod.rs23
2 files changed, 22 insertions, 13 deletions
diff --git a/tvix/eval/src/value/json.rs b/tvix/eval/src/value/json.rs
index fb9750a9fe4a..8c31bd0e6082 100644
--- a/tvix/eval/src/value/json.rs
+++ b/tvix/eval/src/value/json.rs
@@ -34,7 +34,10 @@ impl Value {
                 let mut out = vec![];
 
                 for val in l.into_iter() {
-                    out.push(generators::request_to_json(co, val).await);
+                    match generators::request_to_json(co, val).await {
+                        Ok(v) => out.push(v),
+                        Err(cek) => return Ok(Err(cek)),
+                    }
                 }
 
                 Json::Array(out)
@@ -67,14 +70,17 @@ impl Value {
                 // serialise to a JSON serialisation of that inner
                 // value (regardless of what it is!).
                 if let Some(out_path) = attrs.select("outPath") {
-                    return Ok(Ok(generators::request_to_json(co, out_path.clone()).await));
+                    return Ok(generators::request_to_json(co, out_path.clone()).await);
                 }
 
                 let mut out = Map::with_capacity(attrs.len());
                 for (name, value) in attrs.into_iter_sorted() {
                     out.insert(
                         name.as_str().to_string(),
-                        generators::request_to_json(co, value).await,
+                        match generators::request_to_json(co, value).await {
+                            Ok(v) => v,
+                            Err(cek) => return Ok(Err(cek)),
+                        },
                     );
                 }
 
diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs
index 1558d2cc9c24..ccca0bea5b2e 100644
--- a/tvix/eval/src/value/mod.rs
+++ b/tvix/eval/src/value/mod.rs
@@ -589,16 +589,19 @@ impl Value {
                                         .context("comparing derivations")?
                                         .clone();
 
-                                    let result = out1
-                                        .clone()
-                                        .force(co, span.clone())
-                                        .await?
-                                        .to_contextful_str()?
-                                        == out2
-                                            .clone()
-                                            .force(co, span.clone())
-                                            .await?
-                                            .to_contextful_str()?;
+                                    let out1 = out1.clone().force(co, span.clone()).await?;
+                                    let out2 = out2.clone().force(co, span.clone()).await?;
+
+                                    if out1.is_catchable() {
+                                        return Ok(out1);
+                                    }
+
+                                    if out2.is_catchable() {
+                                        return Ok(out2);
+                                    }
+
+                                    let result =
+                                        out1.to_contextful_str()? == out2.to_contextful_str()?;
                                     if !result {
                                         return Ok(Value::Bool(false));
                                     } else {