1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

double addtrace for 'called from'

This commit is contained in:
Ben Burdette 2020-06-30 15:44:19 -06:00
parent ddb81ca126
commit 70bcb39d3f
2 changed files with 6 additions and 9 deletions

View file

@ -597,11 +597,6 @@ LocalNoInline(void addErrorTrace(Error & e, const char * s, const string & s2))
e.addTrace(std::nullopt, s, s2); e.addTrace(std::nullopt, s, s2);
} }
LocalNoInline(void addErrorTrace(Error & e, const Pos & pos, const char * s, const ExprLambda & fun))
{
e.addTrace(pos, s, fun.showNamePos());
}
LocalNoInline(void addErrorTrace(Error & e, const Pos & pos, const char * s, const string & s2)) LocalNoInline(void addErrorTrace(Error & e, const Pos & pos, const char * s, const string & s2))
{ {
e.addTrace(pos, s, s2); e.addTrace(pos, s, s2);
@ -1241,9 +1236,11 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v, const Pos & po
try { try {
lambda.body->eval(*this, env2, v); lambda.body->eval(*this, env2, v);
} catch (Error & e) { } catch (Error & e) {
// TODO something different for 'called from' than usual addTrace? addErrorTrace(e, lambda.pos, "while evaluating %s",
// addErrorTrace(e, pos, "while evaluating %1%, called from %2%:", lambda); (lambda.name.set()
addErrorTrace(e, pos, "while evaluating %1%:", lambda); ? "'" + (string) lambda.name + "'"
: "anonymous lambdaction"));
addErrorTrace(e, pos, "from call site%s", "");
throw; throw;
} }
else else

View file

@ -330,7 +330,7 @@ std::ostream& showErrorInfo(std::ostream &out, const ErrorInfo &einfo, bool show
// traces // traces
if (showTrace && !einfo.traces.empty()) if (showTrace && !einfo.traces.empty())
{ {
const string tracetitle(" show-trace output "); const string tracetitle(" show-trace ");
int fill = errwidth - tracetitle.length(); int fill = errwidth - tracetitle.length();
int lw = 0; int lw = 0;