aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-03-24 14:02:44 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-03-24 14:02:44 +0000
commitef2d4a2da9c14c15985bdd27c02d2d30093a3e56 (patch)
tree592b98fda0d67050914138b59ffabdd310f29ef9
parentb69e4693287d481ee75f948227a2c508391ef055 (diff)
* Print a more useful stack trace when an error occurs deep in the
derivation dependency graph.
-rw-r--r--src/libexpr/primops.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index c5560be97..3a291e007 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -229,10 +229,16 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args)
ATermMap attrs;
queryAllAttrs(evalExpr(state, args[0]), attrs, true);
+ /* Figure out the name already (for stack backtraces). */
+ Expr eDrvName = attrs.get("name");
+ if (!eDrvName)
+ throw Error("required attribute `name' missing");
+ ATerm posDrvName;
+ if (!matchAttrRHS(eDrvName, eDrvName, posDrvName)) abort();
+ string drvName = evalString(state, eDrvName);
+
/* Build the derivation expression by processing the attributes. */
Derivation drv;
-
- string drvName;
string outputHash;
string outputHashAlgo;
@@ -252,6 +258,8 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args)
} catch (Error & e) {
e.addPrefix(format("while processing 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));
throw;
}
@@ -285,8 +293,6 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args)
throw Error("required attribute `builder' missing");
if (drv.platform == "")
throw Error("required attribute `system' missing");
- if (drvName == "")
- throw Error("required attribute `name' missing");
/* If an output hash was given, check it. */
if (outputHash == "")