17 #ifdef DtUSE_UTILITIES_NAMESPACE
18 namespace DtUSE_UTILITIES_NAMESPACE
46 const char *functionName,
48 unsigned int lineNumber,
62 virtual const DtException *lastException()
const throw();
66 virtual const DtException& initialException()
const throw();
69 virtual const char* message()
const throw();
73 virtual DtString what()
const throw();
76 virtual DtString where()
const throw();
106 const char *functionName,
107 const char *fileName,
108 unsigned int lineNumber,
110 DtException(errorMessage, functionName, fileName, lineNumber, previousException){}
153 #if defined(__GNUC__)
154 #define __DtFUNC__ __PRETTY_FUNCTION__
155 #elif defined(_WIN32) && (_MSC_VER != 1200)
156 #define __DtFUNC__ __FUNCSIG__
158 #define __DtFUNC__ "-Unknown Function-"
164 #define DtTHROW_NEW(exceptionClass,errorMsg) \
165 throw exceptionClass(DtString(#exceptionClass": ") + errorMsg, __DtFUNC__, DtFilename::stripPath(__FILE__), __LINE__, 0)
168 #define DtTHROW_PROPAGATE(exceptionClass, errorMsg, exPtr) \
169 throw exceptionClass(DtString(#exceptionClass": ") + errorMsg, __DtFUNC__, DtFilename::stripPath(__FILE__), __LINE__, exPtr)
173 #define DtCATCH_AND_PROPAGATE(exceptionClass) \
174 catch( DtException &ex) \
176 throw exceptionClass("Propagating DtException.", __DtFUNC__, DtFilename::stripPath(__FILE__), __LINE__, &ex);\
178 catch(std::exception &sexception)\
180 DtString error("std::exception ");\
181 error += sexception.what();\
182 throw exceptionClass(error.c_str(), __DtFUNC__, DtFilename::stripPath(__FILE__), __LINE__, 0); \
186 throw DtUnknownException("Caught Unknown Exception.", __DtFUNC__, DtFilename::stripPath(__FILE__), __LINE__, 0);\
194 #define DtCATCH_AND_WARN(stream) \
195 catch (DtException &ex) \
197 stream << "Caught DtException with stack: \n" << ex << std::endl; \
199 catch (std::exception &sexception) \
201 stream << "Caught std::exception: " << sexception.what() << std::endl; \
205 stream << "Caught Unknown Exception in. " << __DtFUNC__ << "[" << DtFilename::stripPath(__FILE__) << ":" \
206 << __LINE__ << "]" << std::endl; \
218 #define DtPROPAGATE(functionBody)\
221 DtCATCH_AND_PROPAGATE(DtCorruptedState)\
230 #ifdef DtUSE_UTILITIES_NAMESPACE