diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-31 04:17:40 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-31 04:17:40 -0400 |
commit | 97a9b42b2c5ef908e0c47ecfd39771a79f8fa8a2 (patch) | |
tree | 8eadb82cc54e66353e05309fe42c2900b93628bf /src/option.h | |
parent | a2cb549b1dff9024e3f700203e424e496b25fd91 (diff) | |
parent | a0a980b9f4ebf1493682ecf1eb745bf52649aac5 (diff) | |
download | ledger-97a9b42b2c5ef908e0c47ecfd39771a79f8fa8a2.tar.gz ledger-97a9b42b2c5ef908e0c47ecfd39771a79f8fa8a2.tar.bz2 ledger-97a9b42b2c5ef908e0c47ecfd39771a79f8fa8a2.zip |
Merge branch 'next'
Diffstat (limited to 'src/option.h')
-rw-r--r-- | src/option.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/option.h b/src/option.h index 83710a1c..0600779c 100644 --- a/src/option.h +++ b/src/option.h @@ -162,10 +162,21 @@ public: virtual void handler(call_scope_t& args) { if (wants_arg) { - if (args.empty() || args.size() == 1) + if (args.size() < 2) throw_(std::runtime_error, _("No argument provided for %1") << desc()); + else if (args.size() > 2) + throw_(std::runtime_error, _("To many arguments provided for %1") << desc()); + else if (! args[0].is_string()) + throw_(std::runtime_error, _("Context argument for %1 not a string") << desc()); on_with(args[0].as_string(), args[1]); - } else { + } + else if (args.size() < 1) { + throw_(std::runtime_error, _("No argument provided for %1") << desc()); + } + else if (! args[0].is_string()) { + throw_(std::runtime_error, _("Context argument for %1 not a string") << desc()); + } + else { on_only(args[0].as_string()); } |