diff options
Diffstat (limited to 'server/src/configurationparser.h')
-rw-r--r-- | server/src/configurationparser.h | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/server/src/configurationparser.h b/server/src/configurationparser.h index 924c041..8e0c01d 100644 --- a/server/src/configurationparser.h +++ b/server/src/configurationparser.h @@ -30,16 +30,7 @@ #include <libconfig.h++> #include <string> -#include "exception.h" - -/** - * This exception is thrown by Configuration when reload fails. - */ -class ConfigurationParserException: public Exception { -public: - ConfigurationParserException(std::string reason) : - Exception(reason) {} -}; +#include <exception> /** * This is the pentominos configuration class.\n @@ -51,16 +42,39 @@ public: class ConfigurationParser : public libconfig::Config { public: /** + * This exception is thrown by Configuration when reload fails. + */ + class ParseException: public std::exception { + public: + ParseException(int line, std::string err) throw() : l(line), e(err) {} + ~ParseException() throw() {} + const char *what() throw(); + + private: + std::string _what; + int l; + std::string e; + }; + + /** + * This exception is thrown by Configuration when file read fails. + */ + class ReadException: public std::exception {}; + + + /** * Constructor.\n * @param filename The filename to be loaded. */ - ConfigurationParser(std::string filename); + ConfigurationParser(std::string filename) + throw(ParseException, ReadException); /** * reload, simply reloads the configuration file attached to the configuration * object. */ - void reload() throw(ConfigurationParserException); + void reload() + throw(ParseException, ReadException); private: std::string filename; |