X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.hh;h=a91b157d20c3682634d6556dac6a56636abb3039;hb=a1fdb7bb122f0b05be809a922d4b7ef5e125fa67;hp=7abf26cbbc5b0644fd25829c2f63c44d1cf9221f;hpb=be33ff96c5b89738694da272d8610564cce48bfb;p=senf.git diff --git a/Utils/Exception.hh b/Utils/Exception.hh index 7abf26c..a91b157 100644 --- a/Utils/Exception.hh +++ b/Utils/Exception.hh @@ -23,8 +23,8 @@ /** \file \brief Exception public header */ -#ifndef HH_Exception_ -#define HH_Exception_ 1 +#ifndef HH_SENF_Utils_Exception_ +#define HH_SENF_Utils_Exception_ 1 // Custom includes #include @@ -96,9 +96,9 @@ SENF_WRAP_EXC(std::bad_cast) SENF_WRAP_EXC(somelib::FooException) } - \endcode The re-thrown exception can then be caught as std::bad_cast or as - senf::ExceptionMixin as needed. It is safe, to wrap an exception twice (the macro will detect - this case). + \endcode + The re-thrown exception can then be caught as std::bad_cast or as senf::ExceptionMixin + as needed. It is safe, to wrap an exception twice (the macro will detect this case). \code bar() { try { @@ -140,9 +140,9 @@ namespace senf { class ExceptionMixin { public: - std::string const & message() const; + std::string const & message() const; ///< get exception description - void append(std::string text); ///< Extend exception description + void append(std::string text); ///< Extend exception description /**< Adds \a text to the description text. */ protected: @@ -152,7 +152,7 @@ namespace senf { string. This should probably be a string constant describing the exception for most derived exceptions. */ - + std::string what_; private: #ifdef SENF_DEBUG void addBacktrace(); @@ -177,6 +177,9 @@ namespace senf { virtual ~Exception() throw(); virtual char const * what() const throw(); + ///< get exception description and backtrace if available + /**< get description of the exception (message()) and backtrace + information if SENF is compiled with \c SENF_DEBUG */ protected: explicit Exception(std::string const & description = ""); @@ -261,7 +264,7 @@ namespace senf { the exception description: \code // Standard usage: Take \c errno from environment - SENF_THROW_SYSTEM_EXCEPTION() + SENF_THROW_SYSTEM_EXCEPTION("::open()") << " while opening configuration file: " << filename; // You may however explicitly specify the errno value @@ -299,7 +302,6 @@ namespace senf { void init(std::string const & descr, int code _SENF_EXC_DEBUG_ARGS_ND); int code_; - std::string what_; }; # ifdef SENF_DEBUG @@ -308,7 +310,7 @@ namespace senf { # define SENF_EXC_DEBUGINFO # endif -# define SENF_THROW_SYSTEM_EXCEPTION(desc) throw SystemException(desc SENF_EXC_DEBUGINFO) +# define SENF_THROW_SYSTEM_EXCEPTION(desc) throw senf::SystemException(desc SENF_EXC_DEBUGINFO) }