about summary refs log tree commit diff
path: root/src/libexpr
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/eval.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 98b6b7bdd150..e72538e60874 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -681,8 +681,14 @@ bool EvalState::evalBool(Env & env, Expr e)
 void EvalState::forceValue(Value & v)
 {
     if (v.type == tThunk) {
-        //v.type = tBlackhole;
-        eval(*v.thunk.env, v.thunk.expr, v);
+        ValueType saved = v.type;
+        try {
+            v.type = tBlackhole;
+            eval(*v.thunk.env, v.thunk.expr, v);
+        } catch (Error & e) {
+            v.type = saved;
+            throw;
+        }
     }
     else if (v.type == tCopy) {
         forceValue(*v.val);