summaryrefslogtreecommitdiff
path: root/src/amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-29 16:25:22 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-29 16:25:22 -0500
commit0f180b917ae00b7b247db367020fd29823000877 (patch)
tree632df80d2f2a1387dfd4f6b67eda1baf2c2e08d8 /src/amount.cc
parent7422fa5f3e2505dfa8f5494e4ce9e987440a57a1 (diff)
downloadfork-ledger-0f180b917ae00b7b247db367020fd29823000877.tar.gz
fork-ledger-0f180b917ae00b7b247db367020fd29823000877.tar.bz2
fork-ledger-0f180b917ae00b7b247db367020fd29823000877.zip
Improved some error messages
Diffstat (limited to 'src/amount.cc')
-rw-r--r--src/amount.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/amount.cc b/src/amount.cc
index 8c5ae574..2f7b434e 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -398,8 +398,8 @@ int amount_t::compare(const amount_t& amt) const
if (has_commodity() && amt.has_commodity() &&
commodity() != amt.commodity())
throw_(amount_error,
- _("Cannot compare amounts with different commodities: %1 and %2")
- << commodity().symbol() << amt.commodity().symbol());
+ _("Cannot compare amounts with different commodities: '%1' and '%2'")
+ << commodity() << amt.commodity());
return mpq_cmp(MP(quantity), MP(amt.quantity));
}
@@ -430,12 +430,11 @@ amount_t& amount_t::operator+=(const amount_t& amt)
throw_(amount_error, _("Cannot add two uninitialized amounts"));
}
- if (has_commodity() && amt.has_commodity() &&
- commodity() != amt.commodity())
+ if (has_commodity() && amt.has_commodity() && commodity() != amt.commodity()) {
throw_(amount_error,
- _("Adding amounts with different commodities: %1 != %2")
- << (has_commodity() ? commodity().symbol() : _("NONE"))
- << (amt.has_commodity() ? amt.commodity().symbol() : _("NONE")));
+ _("Adding amounts with different commodities: '%1' != '%2'")
+ << commodity() << amt.commodity());
+ }
_dup();
@@ -464,9 +463,8 @@ amount_t& amount_t::operator-=(const amount_t& amt)
if (has_commodity() && amt.has_commodity() &&
commodity() != amt.commodity())
throw_(amount_error,
- _("Subtracting amounts with different commodities: %1 != %2")
- << (has_commodity() ? commodity().symbol() : _("NONE"))
- << (amt.has_commodity() ? amt.commodity().symbol() : _("NONE")));
+ _("Subtracting amounts with different commodities: '%1' != '%2'")
+ << commodity() << amt.commodity());
_dup();