X-Git-Url: http://git.tdb.fi/?p=libs%2Fdatafile.git;a=blobdiff_plain;f=source%2Fexcept.h;h=e68ec481f4aa869ada66a660c59e06e195b6b34b;hp=ff256a4449c0a0eef903857ccfc3312dc4f79569;hb=ed78b585cfc4ecb44972e346857e887b183fd7a7;hpb=7df5e45c7f414f6a07681dc4ec2abb63b091a309 diff --git a/source/except.h b/source/except.h index ff256a4..e68ec48 100644 --- a/source/except.h +++ b/source/except.h @@ -1,21 +1,59 @@ #ifndef MSP_DATAFILE_EXCEPT_H_ #define MSP_DATAFILE_EXCEPT_H_ -#include +#include namespace Msp { namespace DataFile { -class TypeError: public Exception +class data_error: public std::runtime_error +{ +private: + std::string source; + unsigned line; + +public: + data_error(const std::string &, unsigned, const std::string &); + data_error(const std::string &, unsigned, const std::exception &); + virtual ~data_error() throw() { } + + const std::string &get_source() const { return source; } + unsigned get_line() const { return line; } + +private: + std::string make_what(const std::string &, unsigned, const std::string &); +}; + + +class parse_error: public std::runtime_error { public: - TypeError(const std::string &w): Exception(w) { } + parse_error(const std::string &); + virtual ~parse_error() throw() { } }; -class ParseError: public Exception + +class syntax_error: public std::runtime_error +{ +public: + syntax_error(const std::string &t); + virtual ~syntax_error() throw() { } +}; + + +class bad_definition: public std::runtime_error +{ +public: + bad_definition(const std::string &w); + virtual ~bad_definition() throw() { } +}; + + +class nesting_error: public std::logic_error { public: - ParseError(const std::string &w): Exception(w) { } + nesting_error(const std::string &); + virtual ~nesting_error() throw() { } }; } // namespace DataFile