From 76394daca333a03dcea9851d03afb1615717239b Mon Sep 17 00:00:00 2001 From: Yureka Date: Sun, 21 Jul 2024 15:19:16 +0200 Subject: feat(tvix/composition): downcast boxed error if possible 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 Reviewed-by: flokli --- tvix/castore/src/composition.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tvix') 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::(), 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 }) -- cgit 1.4.1