about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-10-23T16·45+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-10-23T16·45+0000
commitdd300fb48dd2048d056a5f25dda7d4c1f5515d46 (patch)
tree4f1bb45f6971517b3553ab930e9ec3cc045bcec9 /src/libexpr/primops.cc
parent1d694eef4ce022a99a3fb552804a1f26f686cc55 (diff)
* Some better error messages.
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 8118f84010..0f62653b0e 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -130,12 +130,19 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args)
     queryAllAttrs(evalExpr(state, args[0]), attrs, true);
 
     /* Figure out the name already (for stack backtraces). */
+    ATerm posDrvName;
     Expr eDrvName = attrs.get(toATerm("name"));
     if (!eDrvName)
         throw EvalError("required attribute `name' missing");
-    ATerm posDrvName;
     if (!matchAttrRHS(eDrvName, eDrvName, posDrvName)) abort();
-    string drvName = evalStringNoCtx(state, eDrvName);
+    string drvName;
+    try {        
+        drvName = evalStringNoCtx(state, eDrvName);
+    } catch (Error & e) {
+        e.addPrefix(format("while evaluating the derivation attribute `name' at %1%:\n")
+            % showPos(posDrvName));
+        throw;
+    }
 
     /* Build the derivation expression by processing the attributes. */
     Derivation drv;
@@ -190,7 +197,7 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args)
             }
 
         } catch (Error & e) {
-            e.addPrefix(format("while processing the derivation attribute `%1%' at %2%:\n")
+            e.addPrefix(format("while evaluating the derivation attribute `%1%' at %2%:\n")
                 % key % showPos(pos));
             e.addPrefix(format("while instantiating the derivation named `%1%' at %2%:\n")
                 % drvName % showPos(posDrvName));