X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fexcept.h;h=bf7c526c378695d353098ef694311ff8231226cc;hb=cfc8e0b7b15ea505bd6a6a9599cbc5ce1e316963;hp=fc6fcc6c69921f48205fea5434a9b8da5cb05671;hpb=7c5ced26f18d29bad4aa7fa14c6c8feba2e269ab;p=libs%2Fcore.git diff --git a/source/core/except.h b/source/core/except.h index fc6fcc6..bf7c526 100644 --- a/source/core/except.h +++ b/source/core/except.h @@ -19,6 +19,11 @@ Base class for all Msp exceptions. */ class Exception: public std::exception { +private: + std::string wot; + std::string wer; + Debug::Backtrace bt; + public: Exception(const std::string &); ~Exception() throw() { } @@ -27,11 +32,6 @@ public: Exception &at(const std::string &) throw(); const char *where() const throw() { return wer.c_str(); } const Debug::Backtrace &get_backtrace() const throw() { return bt; } -private: - std::string wot; - std::string wer; - Debug::Backtrace bt; - }; /** @@ -48,13 +48,15 @@ Thrown when a lookup from a map fails. */ class KeyError: public Exception { +private: + std::string key; + public: KeyError(const std::string &w_): Exception(w_) { } KeyError(const std::string &w_, const std::string &k); - const std::string &get_key() const { return key; } ~KeyError() throw() { } -private: - std::string key; + + const std::string &get_key() const { return key; } }; /** @@ -71,11 +73,12 @@ Thrown when the application is invoked with wrong parameters. */ class UsageError: public Exception { +private: + bool brief; + public: UsageError(const std::string &r, bool b=true): Exception(r), brief(b) { } bool get_brief() const { return brief; } -private: - bool brief; }; /** @@ -83,12 +86,14 @@ Thrown when a system call fails. */ class SystemError: public Exception { +private: + int err; + public: SystemError(const std::string &, int); int get_error_code() const { return err; } -private: - int err; +private: static std::string build_what(const std::string &, int); };