summaryrefslogtreecommitdiff
path: root/option.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-09-25 02:51:55 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-09-25 02:51:55 -0400
commit3a3227298dcd4faabd93e6f4bcaede10f29b13fd (patch)
treee618bb410b1d25db8c05acafc0023e304d5156e6 /option.h
parentfbad0421789856debcacf4d7138e39b08908a077 (diff)
downloadfork-ledger-3a3227298dcd4faabd93e6f4bcaede10f29b13fd.tar.gz
fork-ledger-3a3227298dcd4faabd93e6f4bcaede10f29b13fd.tar.bz2
fork-ledger-3a3227298dcd4faabd93e6f4bcaede10f29b13fd.zip
if a commodity price cannot be downloaded, report it as an error
Diffstat (limited to 'option.h')
-rw-r--r--option.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/option.h b/option.h
index 49f228cd..2e4d7599 100644
--- a/option.h
+++ b/option.h
@@ -3,6 +3,7 @@
#include <list>
#include <string>
+#include <exception>
struct option_handler {
bool handled;
@@ -19,6 +20,17 @@ struct option_t {
option_t() : short_opt(0), wants_arg(false), handler(NULL) {}
};
+class option_error : public std::exception {
+ std::string reason;
+ public:
+ option_error(const std::string& _reason) throw() : reason(_reason) {}
+ virtual ~option_error() throw() {}
+
+ virtual const char* what() const throw() {
+ return reason.c_str();
+ }
+};
+
void add_option_handler(std::list<option_t>& options, const std::string& label,
const std::string& opt_chars, option_handler& option);
bool process_option(std::list<option_t>& options,