Index: src/libchcore/TCoreException.h =================================================================== diff -u -N -r5fd6beaad9f1eccb664b997d151acb59961e4827 -rab32897e61cc637a1e28d9dc3f0489b8d16a429c --- src/libchcore/TCoreException.h (.../TCoreException.h) (revision 5fd6beaad9f1eccb664b997d151acb59961e4827) +++ src/libchcore/TCoreException.h (.../TCoreException.h) (revision ab32897e61cc637a1e28d9dc3f0489b8d16a429c) @@ -27,9 +27,13 @@ // throws core exception object #define THROW_CORE_EXCEPTION(error_code)\ throw TCoreException(error_code, __FILEW__, __LINE__, __FUNCTIONW__) + #define THROW_CORE_EXCEPTION_STD(error_code, std_exception)\ throw TCoreException(error_code, std_exception, __FILEW__, __LINE__, __FUNCTIONW__) +#define THROW_CORE_EXCEPTION_WIN32(error_code, win32_error_code)\ + throw TCoreWin32Exception(error_code, win32_error_code, __FILEW__, __LINE__, __FUNCTIONW__) + class LIBCHCORE_API TCoreException : public virtual std::exception { public: @@ -47,7 +51,7 @@ void GetErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const; private: - TCoreException() {} + TCoreException(); protected: // what happened? @@ -59,6 +63,29 @@ size_t m_stLineNumber; }; +class LIBCHCORE_API TCoreWin32Exception : public TCoreException +{ +public: + TCoreWin32Exception(EGeneralErrors eErrorCode, DWORD dwWin32Exception, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction); + + DWORD GetWin32ErrorCode() const { return m_dwWin32ErrorCode; } + + void GetErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const; + +private: + TCoreWin32Exception(); + +protected: + // what happened? + EGeneralErrors m_eErrorCode; + DWORD m_dwWin32ErrorCode; + + // where it happened? + const wchar_t* m_pszFile; + const wchar_t* m_pszFunction; + size_t m_stLineNumber; +}; + END_CHCORE_NAMESPACE #endif