about summary refs log tree commit diff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-06-01T11·19+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-06-01T11·19+0000
commit89865da76d87292e5bc61f324b1ac892d40236e7 (patch)
tree44ca094d56bbeff0c03626420a0c455f98f083a0 /src/libexpr
parent8bcdd36f10c5adfd312493c822c95c6fa5fbd110 (diff)
* Turn build errors during evaluation into EvalErrors.
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/nixexpr.hh1
-rw-r--r--src/libexpr/primops.cc6
2 files changed, 6 insertions, 1 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh
index 1c72441b2792..b1043a32684e 100644
--- a/src/libexpr/nixexpr.hh
+++ b/src/libexpr/nixexpr.hh
@@ -15,6 +15,7 @@ MakeError(AssertionError, EvalError)
 MakeError(ThrownError, AssertionError)
 MakeError(Abort, EvalError)
 MakeError(TypeError, EvalError)
+MakeError(ImportError, EvalError) // error building an imported derivation
 
 
 /* Position objects. */
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 9d36fb6a05d7..42c8586116aa 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -37,7 +37,11 @@ static void prim_import(EvalState & state, Value * * args, Value & v)
             throw EvalError(format("cannot import `%1%', since path `%2%' is not valid")
                 % path % *i);
         if (isDerivation(*i))
-            store->buildDerivations(singleton<PathSet>(*i));
+            try {
+                store->buildDerivations(singleton<PathSet>(*i));
+            } catch (Error & e) {
+                throw ImportError(e.msg());
+            }
     }
 
     state.evalFile(path, v);