aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-01-13 21:49:55 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-01-13 21:49:55 +0100
commitbfaa4db7bdddcab995a75a6ee5377bdc858167d0 (patch)
tree86e4fccdc2ca9d6d2d9608023db9c597a877ef50 /src/libexpr/eval.cc
parentd64ab5131c376a0e96075ec133dfd4185505594f (diff)
parent307bcb9a8e7a16bfc451e055a620b766df9d3f7d (diff)
Merge branch 'assert-show-expression' of https://github.com/LnL7/nix
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 1c787645d..3a3810f24 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -531,9 +531,9 @@ LocalNoInlineNoReturn(void throwTypeError(const char * s, const ExprLambda & fun
throw TypeError(format(s) % fun.showNamePos() % s2 % pos);
}
-LocalNoInlineNoReturn(void throwAssertionError(const char * s, const Pos & pos))
+LocalNoInlineNoReturn(void throwAssertionError(const char * s, const string & s1, const Pos & pos))
{
- throw AssertionError(format(s) % pos);
+ throw AssertionError(format(s) % s1 % pos);
}
LocalNoInlineNoReturn(void throwUndefinedVarError(const char * s, const string & s1, const Pos & pos))
@@ -1262,8 +1262,11 @@ void ExprIf::eval(EvalState & state, Env & env, Value & v)
void ExprAssert::eval(EvalState & state, Env & env, Value & v)
{
- if (!state.evalBool(env, cond, pos))
- throwAssertionError("assertion failed at %1%", pos);
+ if (!state.evalBool(env, cond, pos)) {
+ std::ostringstream out;
+ cond->show(out);
+ throwAssertionError("assertion %1% failed at %2%", out.str(), pos);
+ }
body->eval(state, env, v);
}