diff options
-rw-r--r-- | libadhocutil/exception.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libadhocutil/exception.h b/libadhocutil/exception.h index a63439b..fd4263c 100644 --- a/libadhocutil/exception.h +++ b/libadhocutil/exception.h @@ -6,9 +6,11 @@ #include <boost/optional.hpp> namespace AdHoc { + /// Helper class for lazy creation of exception message text. template <typename BaseException> class Exception : public BaseException { public: + /// Override of std::exception::what() to create text as required. inline const char * what() const throw() override { if (!msg) { @@ -18,6 +20,7 @@ namespace AdHoc { } private: + /// Message text provider. virtual std::string message() const throw() = 0; mutable boost::optional<std::string> msg; }; |