summaryrefslogtreecommitdiff
path: root/src/report.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-03 15:34:08 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-03 15:34:08 -0500
commita77d9fc2617c639f146aeb31b5eaeaa30fa96e5d (patch)
treeb6df4ffa6f9778877e06fc7a4ae904990f803dc6 /src/report.cc
parentbdb3ebca3fd33d530a0c38b739622082d23b6d93 (diff)
downloadledger-a77d9fc2617c639f146aeb31b5eaeaa30fa96e5d.tar.gz
ledger-a77d9fc2617c639f146aeb31b5eaeaa30fa96e5d.tar.bz2
ledger-a77d9fc2617c639f146aeb31b5eaeaa30fa96e5d.zip
Added error message if a predicate query is invalid
Diffstat (limited to 'src/report.cc')
-rw-r--r--src/report.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/report.cc b/src/report.cc
index 60f6955c..fe482a2e 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -413,6 +413,9 @@ namespace {
args.value().as_sequence().end();
std::pair<expr_t, query_parser_t> info = args_to_predicate(begin, end);
+ if (! info.first)
+ throw_(std::runtime_error,
+ _("Invalid query predicate: %1") << join_args(args));
string limit = info.first.text();
if (! limit.empty())
@@ -422,7 +425,12 @@ namespace {
"Predicate = " << report.HANDLER(limit_).str());
if (info.second.tokens_remaining()) {
- string display = args_to_predicate(info.second).first.text();
+ info = args_to_predicate(info.second);
+ if (! info.first)
+ throw_(std::runtime_error,
+ _("Invalid display predicate: %1") << join_args(args));
+
+ string display = info.first.text();
if (! display.empty())
report.HANDLER(display_).on(whence, display);