about summary refs log tree commit diff
path: root/tvix/castore/src/composition.rs
diff options
context:
space:
mode:
authorYureka <tvl@yuka.dev>2024-07-21T13·19+0200
committerclbot <clbot@tvl.fyi>2024-07-21T17·03+0000
commit76394daca333a03dcea9851d03afb1615717239b (patch)
tree64e0900f648aa7432211af60de8f49fcd1dff56a /tvix/castore/src/composition.rs
parent1f89cf90275ee171459daf21a9a223b5dce7935c (diff)
feat(tvix/composition): downcast boxed error if possible r/8390
We still have the unique store name to identify which instantiation caused the error. For recursion errors, the full chain is still retained inside the CompositionError.

Change-Id: Iaddcece445a5df331e578d7c69d710db3d5f8dcd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12002
Tested-by: BuildkiteCI
Autosubmit: yuka <yuka@yuka.dev>
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/castore/src/composition.rs')
-rw-r--r--tvix/castore/src/composition.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/tvix/castore/src/composition.rs b/tvix/castore/src/composition.rs
index 1ff7e1b5bed8..53e2fe1594fb 100644
--- a/tvix/castore/src/composition.rs
+++ b/tvix/castore/src/composition.rs
@@ -431,10 +431,13 @@ impl Composition {
                         new_context
                             .stack
                             .push((TypeId::of::<T>(), entrypoint.clone()));
-                        let res = config
-                            .build(&entrypoint, &new_context)
-                            .await
-                            .map_err(|e| CompositionError::Failed(entrypoint, e.into()));
+                        let res =
+                            config.build(&entrypoint, &new_context).await.map_err(|e| {
+                                match e.downcast() {
+                                    Ok(e) => *e,
+                                    Err(e) => CompositionError::Failed(entrypoint, e.into()),
+                                }
+                            });
                         tx.send(Some(res.clone())).unwrap();
                         res
                     })