summaryrefslogtreecommitdiff
path: root/textual.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-02-20 00:04:21 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:25 -0400
commitc51704a2a10b25abf17e68ee498fbd30e8204fd0 (patch)
tree124f1dc82a5021bdc88b92826988095eac7f0a34 /textual.cc
parent8916ec24830ca0747676e2a611de77bb850b23e1 (diff)
downloadfork-ledger-c51704a2a10b25abf17e68ee498fbd30e8204fd0.tar.gz
fork-ledger-c51704a2a10b25abf17e68ee498fbd30e8204fd0.tar.bz2
fork-ledger-c51704a2a10b25abf17e68ee498fbd30e8204fd0.zip
(parse): Do not balance automated entries: they are now balanced as
part of the entry they match. (parse): Report the remainder of failed balances using `entry_balance'. This can give a much better idea of what went wrong, especially when values are being calculated.
Diffstat (limited to 'textual.cc')
-rw-r--r--textual.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/textual.cc b/textual.cc
index f3b0f9f6..5e397031 100644
--- a/textual.cc
+++ b/textual.cc
@@ -675,17 +675,12 @@ unsigned int textual_parser_t::parse(std::istream& in,
auto_entry_t * ae = new auto_entry_t(skip_ws(line + 1));
if (parse_transactions(in, account_stack.front(), *ae, "automated")) {
- if (ae->finalize()) {
- journal->auto_entries.push_back(ae);
- ae->src_idx = src_idx;
- ae->beg_pos = beg_pos;
- ae->beg_line = beg_line;
- ae->end_pos = in.tellg();
- ae->end_line = linenum;
- } else {
- throw parse_error(path, linenum,
- "Automated entry failed to balance");
- }
+ journal->auto_entries.push_back(ae);
+ ae->src_idx = src_idx;
+ ae->beg_pos = beg_pos;
+ ae->beg_line = beg_line;
+ ae->end_pos = in.tellg();
+ ae->end_line = linenum;
}
break;
}
@@ -778,7 +773,12 @@ unsigned int textual_parser_t::parse(std::istream& in,
} else {
print_entry(std::cerr, *entry);
delete entry;
- throw parse_error(path, first_line, "Entry above does not balance");
+
+ std::string msgbuf;
+ std::ostringstream msg(msgbuf);
+ msg << "Entry above does not balance; remainder is: "
+ << entry_balance;
+ throw parse_error(path, first_line, msg.str());
}
} else {
throw parse_error(path, first_line, "Failed to parse entry");