summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-19 13:26:22 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-19 13:26:22 -0400
commit33786a5c8ae9aac88e669f220d25b49f8aa1a748 (patch)
tree8db59f4310238193595d287b570527940c00deda
parent509ad47b391e0f583e286b49f48b920e93a05d61 (diff)
downloadfork-ledger-33786a5c8ae9aac88e669f220d25b49f8aa1a748.tar.gz
fork-ledger-33786a5c8ae9aac88e669f220d25b49f8aa1a748.tar.bz2
fork-ledger-33786a5c8ae9aac88e669f220d25b49f8aa1a748.zip
Moved an exception, so the report is more general
-rw-r--r--src/filters.cc39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/filters.cc b/src/filters.cc
index 5f7a79a1..5ec267e9 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -42,8 +42,15 @@ pass_down_xacts::pass_down_xacts(xact_handler_ptr handler,
{
TRACE_CTOR(pass_down_xacts, "xact_handler_ptr, xacts_iterator");
- for (xact_t * xact = iter(); xact; xact = iter())
- item_handler<xact_t>::operator()(*xact);
+ for (xact_t * xact = iter(); xact; xact = iter()) {
+ try {
+ item_handler<xact_t>::operator()(*xact);
+ }
+ catch (const std::exception& err) {
+ add_error_context(item_context(*xact, "While handling transaction"));
+ throw;
+ }
+ }
item_handler<xact_t>::flush();
}
@@ -187,27 +194,21 @@ void anonymize_xacts::operator()(xact_t& xact)
void calc_xacts::operator()(xact_t& xact)
{
- try {
- xact_t::xdata_t& xdata(xact.xdata());
+ xact_t::xdata_t& xdata(xact.xdata());
- if (last_xact) {
- assert(last_xact->has_xdata());
- add_or_set_value(xdata.total, last_xact->xdata().total);
- xdata.count = last_xact->xdata().count + 1;
- } else {
- xdata.count = 1;
- }
+ if (last_xact) {
+ assert(last_xact->has_xdata());
+ add_or_set_value(xdata.total, last_xact->xdata().total);
+ xdata.count = last_xact->xdata().count + 1;
+ } else {
+ xdata.count = 1;
+ }
- xact.add_to_value(xdata.total, amount_expr);
+ xact.add_to_value(xdata.total, amount_expr);
- item_handler<xact_t>::operator()(xact);
+ item_handler<xact_t>::operator()(xact);
- last_xact = &xact;
- }
- catch (const std::exception& err) {
- add_error_context(item_context(xact, "While calculating transaction"));
- throw;
- }
+ last_xact = &xact;
}
void invert_xacts::operator()(xact_t& xact)