Print better error msg if evaluating mask as bool

This commit is contained in:
John Wiegley 2009-02-26 05:35:57 -04:00
parent 69e2c733b9
commit f09c3906a2

View file

@ -93,6 +93,13 @@ value_t::operator bool() const
return as_balance();
case STRING:
return ! as_string().empty();
case MASK: {
std::ostringstream out;
out << *this;
throw_(value_error,
_("Cannot determine truth of %1 (did you mean 'account =~ %2'?)")
<< label() << out.str());
}
case SEQUENCE:
if (! as_sequence().empty()) {
foreach (const value_t& value, as_sequence()) {