summaryrefslogtreecommitdiff
path: root/parser.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-31 06:24:45 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-31 06:24:45 -0400
commit99313ebc6c3779f692f9f1bd70cc69a236f5eb78 (patch)
tree44a553891a9aaa148084d8e011b2d326401343e9 /parser.cc
parent8afd926a27af55862ce360970e05d747f249a0da (diff)
downloadledger-99313ebc6c3779f692f9f1bd70cc69a236f5eb78.tar.gz
ledger-99313ebc6c3779f692f9f1bd70cc69a236f5eb78.tar.bz2
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 'parser.cc')
-rw-r--r--parser.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/parser.cc b/parser.cc
index a03ea9df..85d92901 100644
--- a/parser.cc
+++ b/parser.cc
@@ -419,9 +419,7 @@ expr_t::parser_t::parse_value_expr(std::istream& in,
expr_t::ptr_op_t
expr_t::parser_t::parse(std::istream& in, const flags_t flags)
{
-#if 0
try {
-#endif
ptr_op_t top_node = parse_value_expr(in, flags);
if (use_lookahead) {
@@ -431,15 +429,14 @@ expr_t::parser_t::parse(std::istream& in, const flags_t flags)
lookahead.clear();
return top_node;
-#if 0
}
- catch (error * err) {
- err->context.push_back
- (new line_context(str, (long)in.tellg() - 1,
- "While parsing value expression:"));
+ catch (const std::exception& err) {
+ add_error_context("While parsing value expression:\n");
+#if 0
+ add_error_context(line_context(str, (long)in.tellg() - 1));
+#endif
throw err;
}
-#endif
}
} // namespace ledger