X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.cci;h=6f7e13dc08ebf1c27bc44766b761d05d44393d30;hb=f214d8c456b57c851066b6dd437049938f8a91ee;hp=f6d5a0af8abbdef2e1143a250917da722dfe0df3;hpb=a66bffcc77f006b22190e1c27cbe0cd75fc4501c;p=senf.git diff --git a/Utils/Exception.cci b/Utils/Exception.cci index f6d5a0a..6f7e13d 100644 --- a/Utils/Exception.cci +++ b/Utils/Exception.cci @@ -28,26 +28,65 @@ ///////////////////////////////cci.p/////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// +// senf::ExceptionMixin + +prefix_ senf::ExceptionMixin::ExceptionMixin(std::string const & description) + : what_(description) +{ +#ifdef SENF_DEBUG + addBacktrace(); +#endif +} + +prefix_ std::string senf::ExceptionMixin::message() + const +{ +#ifdef SENF_DEBUG + return what_.substr(excLen_); +#else + return what_; +#endif +} + +prefix_ std::string senf::ExceptionMixin::backtrace() + const +{ +#ifdef SENF_DEBUG + return what_.substr(0,excLen_-4); +#else + return ""; +#endif +} + +prefix_ void senf::ExceptionMixin::append(std::string 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 & descr) +prefix_ senf::SystemException::SystemException(std::string const & descr _SENF_EXC_DEBUG_ARGS_ND) { - init(descr, 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 & descr, int code) +prefix_ senf::SystemException::SystemException(std::string const & descr, int code + _SENF_EXC_DEBUG_ARGS_ND) { - init(descr, code); + init(descr, code _SENF_EXC_DEBUG_ARGS_P); } prefix_ int senf::SystemException::errorNumber()