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:
parent
0eb200e569
commit
39d1da7b51
|
@ -248,7 +248,7 @@ struct CompareValues
|
||||||
bool operator () (const Value * v1, const Value * v2) const
|
bool operator () (const Value * v1, const Value * v2) const
|
||||||
{
|
{
|
||||||
if (v1->type != v2->type)
|
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) {
|
switch (v1->type) {
|
||||||
case tInt:
|
case tInt:
|
||||||
return v1->integer < v2->integer;
|
return v1->integer < v2->integer;
|
||||||
|
|
Loading…
Reference in a new issue