From 99313ebc6c3779f692f9f1bd70cc69a236f5eb78 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 31 Jul 2008 06:24:45 -0400 Subject: 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. --- reconcile.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'reconcile.cc') 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!"); } } -- cgit v1.2.3