aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-01-21 21:18:52 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-01-21 21:18:52 +0100
commit6fadb3fc03a1a3d51a1aaea003bfbe347c3879b3 (patch)
tree2bd6687cc2c2cb83a9ed4666ed06afb5c8a967ec /src/libexpr/eval.cc
parent62f712c8aedc08d6478ce9b380a2cf317d7e4d3a (diff)
parentaef635da78d33bf679f49fd10e7130d918a82549 (diff)
Merge remote-tracking branch 'origin/master' into flakes
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 427a6f299..852e8aa11 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -566,9 +566,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))
@@ -1302,8 +1302,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);
}