From 3a3227298dcd4faabd93e6f4bcaede10f29b13fd Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 25 Sep 2004 02:51:55 -0400 Subject: if a commodity price cannot be downloaded, report it as an error --- option.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'option.h') diff --git a/option.h b/option.h index 49f228cd..2e4d7599 100644 --- a/option.h +++ b/option.h @@ -3,6 +3,7 @@ #include #include +#include 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& options, const std::string& label, const std::string& opt_chars, option_handler& option); bool process_option(std::list& options, -- cgit v1.2.3