* Print a more useful stack trace when an error occurs deep in the
derivation dependency graph.
This commit is contained in:
parent
b69e469328
commit
ef2d4a2da9
1 changed files with 10 additions and 4 deletions
|
@ -229,11 +229,17 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args)
|
||||||
ATermMap attrs;
|
ATermMap attrs;
|
||||||
queryAllAttrs(evalExpr(state, args[0]), attrs, true);
|
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. */
|
/* Build the derivation expression by processing the attributes. */
|
||||||
Derivation drv;
|
Derivation drv;
|
||||||
|
|
||||||
string drvName;
|
|
||||||
|
|
||||||
string outputHash;
|
string outputHash;
|
||||||
string outputHashAlgo;
|
string outputHashAlgo;
|
||||||
bool outputHashRecursive = false;
|
bool outputHashRecursive = false;
|
||||||
|
@ -252,6 +258,8 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args)
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
e.addPrefix(format("while processing the derivation attribute `%1%' at %2%:\n")
|
e.addPrefix(format("while processing the derivation attribute `%1%' at %2%:\n")
|
||||||
% key % showPos(pos));
|
% key % showPos(pos));
|
||||||
|
e.addPrefix(format("while instantiating the derivation named `%1%' at %2%:\n")
|
||||||
|
% drvName % showPos(posDrvName));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,8 +293,6 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args)
|
||||||
throw Error("required attribute `builder' missing");
|
throw Error("required attribute `builder' missing");
|
||||||
if (drv.platform == "")
|
if (drv.platform == "")
|
||||||
throw Error("required attribute `system' missing");
|
throw Error("required attribute `system' missing");
|
||||||
if (drvName == "")
|
|
||||||
throw Error("required attribute `name' missing");
|
|
||||||
|
|
||||||
/* If an output hash was given, check it. */
|
/* If an output hash was given, check it. */
|
||||||
if (outputHash == "")
|
if (outputHash == "")
|
||||||
|
|
Loading…
Reference in a new issue