summaryrefslogtreecommitdiff
path: root/src/textual.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2016-04-20 21:28:14 -0700
committerJohn Wiegley <johnw@newartisans.com>2016-04-20 21:28:14 -0700
commit8bdc0bba7cbd2b1c404553793468ced78170849a (patch)
tree63b13116f1f0a71dfe474cc8ddf636658da6a199 /src/textual.cc
parent6065ad71fc693c2d03ed0db9742ea4b41a7a2ac5 (diff)
parentd300dfefec6210a326bdd12f12be1a93db305dab (diff)
downloadfork-ledger-8bdc0bba7cbd2b1c404553793468ced78170849a.tar.gz
fork-ledger-8bdc0bba7cbd2b1c404553793468ced78170849a.tar.bz2
fork-ledger-8bdc0bba7cbd2b1c404553793468ced78170849a.zip
Merge pull request #446 from Rudd-O/truepyerrors
Ensure that parse errors produce useful RuntimeErrors for Python code.
Diffstat (limited to 'src/textual.cc')
-rw-r--r--src/textual.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/textual.cc b/src/textual.cc
index ccd87ca0..c97b8b01 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -282,6 +282,10 @@ void instance_t::parse()
std::cerr << _("Error: ") << err.what() << std::endl;
context.errors++;
+ if (! current_context.empty())
+ context.last = current_context + "\n" + err.what();
+ else
+ context.last = err.what();
}
}
@@ -1998,7 +2002,8 @@ std::size_t journal_t::read_textual(parse_context_stack_t& context_stack)
TRACE_FINISH(parsing_total, 1);
if (context_stack.get_current().errors > 0)
- throw error_count(context_stack.get_current().errors);
+ throw error_count(context_stack.get_current().errors,
+ context_stack.get_current().last);
return context_stack.get_current().count;
}