about summary refs log tree commit diff
path: root/tvix/eval/src/value/thunk.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-01T21·13+0300
committertazjin <tazjin@tvl.su>2022-09-08T07·59+0000
commit0a13d267f0aa0ab1c70b6ac0e0ee8a44071b3d40 (patch)
tree5046a5c137b76b917e5c56379a7ba6a152b47e8c /tvix/eval/src/value/thunk.rs
parent377ba19d75a0354c51d73dd38c4a29feefcc68e4 (diff)
fix(tvix/eval): thread thunk forcing errors through correctly r/4742
With this, if an error occurs while forcing a thunk (which is very
likely) it is threaded through to the top by wrapping it in the
ErrorKind::ThunkForce variant.

We could use this to generate "stacktrace-like" error output if we
wanted, or simply jump through and discard everything except the
innermost error.

Change-Id: I3c1c8708c2f73ae062815adf490ce935b1979da8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6409
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to '')
-rw-r--r--tvix/eval/src/value/thunk.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/eval/src/value/thunk.rs b/tvix/eval/src/value/thunk.rs
index c2552284fe..4fd41689c7 100644
--- a/tvix/eval/src/value/thunk.rs
+++ b/tvix/eval/src/value/thunk.rs
@@ -85,9 +85,9 @@ impl Thunk {
                         std::mem::replace(&mut *thunk_mut, ThunkRepr::Blackhole)
                     {
                         vm.call(lambda, upvalues, 0);
-                        // TODO: find a cheap way to actually retain
-                        // the original error span
-                        *thunk_mut = ThunkRepr::Evaluated(vm.run().map_err(|e| e.kind)?);
+                        *thunk_mut = ThunkRepr::Evaluated(
+                            vm.run().map_err(|e| ErrorKind::ThunkForce(Box::new(e)))?,
+                        );
                     }
                 }
             }