summaryrefslogtreecommitdiff
path: root/src/precmd.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/precmd.cc
parentbdb3ebca3fd33d530a0c38b739622082d23b6d93 (diff)
downloadfork-ledger-a77d9fc2617c639f146aeb31b5eaeaa30fa96e5d.tar.gz
fork-ledger-a77d9fc2617c639f146aeb31b5eaeaa30fa96e5d.tar.bz2
fork-ledger-a77d9fc2617c639f146aeb31b5eaeaa30fa96e5d.zip
Added error message if a predicate query is invalid
Diffstat (limited to 'src/precmd.cc')
-rw-r--r--src/precmd.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/precmd.cc b/src/precmd.cc
index a08fd2d6..479d7c2d 100644
--- a/src/precmd.cc
+++ b/src/precmd.cc
@@ -231,6 +231,9 @@ value_t args_command(call_scope_t& args)
out << std::endl << std::endl;
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));
call_scope_t sub_args(static_cast<scope_t&>(args));
sub_args.push_back(string_value(info.first.text()));
@@ -242,8 +245,12 @@ value_t args_command(call_scope_t& args)
<< std::endl << std::endl;
call_scope_t disp_sub_args(static_cast<scope_t&>(args));
- disp_sub_args.push_back
- (string_value(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));
+
+ disp_sub_args.push_back(string_value(info.first.text()));
parse_command(disp_sub_args);
}