Better error message

Also show types when nix cannot compare values of different types.
This is also more consistent since types are already shown when comparing values of the same not comparable type.
This commit is contained in:
Fabian Schmitthenner 2015-11-28 01:24:10 +00:00 committed by Eelco Dolstra
parent 0eb200e569
commit 39d1da7b51

View file

@ -248,7 +248,7 @@ struct CompareValues
bool operator () (const Value * v1, const Value * v2) const
{
if (v1->type != v2->type)
throw EvalError("cannot compare values of different types");
throw EvalError(format("cannot compare %1% with %2%") % showType(*v1) % showType(*v2));
switch (v1->type) {
case tInt:
return v1->integer < v2->integer;