X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.cci;h=3366fe23467d20109a35c3d00a3e941169c142ea;hb=5443435c4c2b6e4386c5334b5b8358273f2bae93;hp=efe49618d6ec26100f7739dee85eb0ce4a63ea98;hpb=25fe79f266e7583750d8e761abec4022d87972b8;p=senf.git diff --git a/Utils/Exception.cci b/Utils/Exception.cci index efe4961..3366fe2 100644 --- a/Utils/Exception.cci +++ b/Utils/Exception.cci @@ -28,26 +28,53 @@ ///////////////////////////////cci.p/////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// +// senf::ExceptionMixin + +prefix_ senf::ExceptionMixin::ExceptionMixin(std::string const & description) + : what_(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; + what_ += 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 +83,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_);