X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.cci;h=189c2f1e24f21f47ff8433f24eaad4494fd6d546;hb=412024ed31a4ab4eaea7a4165a434f8efebee325;hp=efe49618d6ec26100f7739dee85eb0ce4a63ea98;hpb=25fe79f266e7583750d8e761abec4022d87972b8;p=senf.git diff --git a/Utils/Exception.cci b/Utils/Exception.cci index efe4961..189c2f1 100644 --- a/Utils/Exception.cci +++ b/Utils/Exception.cci @@ -28,26 +28,51 @@ ///////////////////////////////cci.p/////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// +// senf::ExceptionMixin + +prefix_ senf::ExceptionMixin::ExceptionMixin(std::string const & description) + : message_(description) +{ +#ifdef SENF_DEBUG + addBacktrace(); +#endif +} + +prefix_ std::string const & senf::ExceptionMixin::message() + const +{ + return message_; +} + +prefix_ void senf::ExceptionMixin::append(std::string text) +{ + message_ += text; +} + +/////////////////////////////////////////////////////////////////////////// // senf::Exception + prefix_ senf::Exception::Exception(std::string const & description) - : message_(description) + : ExceptionMixin(description) {} /////////////////////////////////////////////////////////////////////////// +// senf::SystemException -prefix_ senf::SystemException::SystemException(std::string const & where) +prefix_ senf::SystemException::SystemException(std::string const & descr _SENF_EXC_DEBUG_ARGS_ND) { - init(where, errno); + init(descr, errno _SENF_EXC_DEBUG_ARGS_P); } -prefix_ senf::SystemException::SystemException(int code) +prefix_ senf::SystemException::SystemException(int code _SENF_EXC_DEBUG_ARGS_ND) { - init("", code); + init("", code _SENF_EXC_DEBUG_ARGS_P); } -prefix_ senf::SystemException::SystemException(std::string const & where, int code) +prefix_ senf::SystemException::SystemException(std::string const & descr, int code + _SENF_EXC_DEBUG_ARGS_ND) { - init(where, code); + init(descr, code _SENF_EXC_DEBUG_ARGS_P); } prefix_ int senf::SystemException::errorNumber() @@ -56,7 +81,7 @@ prefix_ int senf::SystemException::errorNumber() return code_; } -prefix_ char const * senf::SystemException::description() +prefix_ char const * senf::SystemException::errorString() const { return std::strerror(code_);