diff options
author | John Wiegley <johnw@newartisans.com> | 2008-07-31 06:24:45 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-07-31 06:24:45 -0400 |
commit | 99313ebc6c3779f692f9f1bd70cc69a236f5eb78 (patch) | |
tree | 44a553891a9aaa148084d8e011b2d326401343e9 /reconcile.cc | |
parent | 8afd926a27af55862ce360970e05d747f249a0da (diff) | |
download | fork-ledger-99313ebc6c3779f692f9f1bd70cc69a236f5eb78.tar.gz fork-ledger-99313ebc6c3779f692f9f1bd70cc69a236f5eb78.tar.bz2 fork-ledger-99313ebc6c3779f692f9f1bd70cc69a236f5eb78.zip |
Revised the way that exceptions are thrown around. Instead of context being a
complicated string of pointers, it's now just a global block of text that gets
appended to as the error is being thrown up, and can be displayed at the catch
point if desired. There are almost no cases where a thrown exception will not
result in an error message being displayed to the user.
Diffstat (limited to 'reconcile.cc')
-rw-r--r-- | reconcile.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/reconcile.cc b/reconcile.cc index d83eb37a..b3f53483 100644 --- a/reconcile.cc +++ b/reconcile.cc @@ -59,7 +59,7 @@ void reconcile_xacts::flush() } if (cleared_balance.type() >= value_t::BALANCE) - throw new error("Cannot reconcile accounts with multiple commodities"); + throw std::runtime_error("Cannot reconcile accounts with multiple commodities"); cleared_balance.cast(value_t::AMOUNT); balance.cast(value_t::AMOUNT); @@ -69,8 +69,9 @@ void reconcile_xacts::flush() balance -= cleared_balance; if (balance.type() >= value_t::BALANCE) - throw new error(string("Reconcile balance is not of the same commodity ('") + - b_comm.symbol() + string("' != '") + cb_comm.symbol() + "')"); + throw_(std::runtime_error, + "Reconcile balance is not of the same commodity ('" + << b_comm.symbol() << "' != '" << cb_comm.symbol() << "')"); // If the amount to reconcile is the same as the pending balance, // then assume an exact match and return the results right away. @@ -80,7 +81,7 @@ void reconcile_xacts::flush() search_for_balance(to_reconcile, &first, first)) { push_to_handler(first); } else { - throw new error("Could not reconcile account!"); + throw std::runtime_error("Could not reconcile account!"); } } |