Index: src/libchcore/TCoreException.cpp =================================================================== diff -u -N -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r0c48142d3db406c32c05d7afdf77da45b2459b34 --- src/libchcore/TCoreException.cpp (.../TCoreException.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TCoreException.cpp (.../TCoreException.cpp) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) @@ -18,75 +18,7 @@ ***************************************************************************/ #include "stdafx.h" #include "TCoreException.h" -#include namespace chcore { - // ============================================================================ - /// TCoreException::TCoreException - /// @date 2009/11/30 - /// - /// @brief Constructs core exception object with additional data. - /// @param[in] eErrorCode - error code - /// @param[in] pszFile - source file name - /// @param[in] stLineNumber - source line number - /// @param[in] pszFunction - function name in which the problem occured. - // ============================================================================ - TCoreException::TCoreException(EGeneralErrors eErrorCode, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction) : - TBaseException(eErrorCode, _T(""), pszFile, stLineNumber, pszFunction) - { - } - - // ============================================================================ - /// TCoreException::TCoreException - /// @date 2009/11/30 - /// - /// @brief Constructs core exception object with additional data. - /// @param[in] eErrorCode - error code - /// @param[in] stdException - standard exception info - /// @param[in] pszFile - source file name - /// @param[in] stLineNumber - source line number - /// @param[in] pszFunction - function name in which the problem occured. - // ============================================================================ - TCoreException::TCoreException(EGeneralErrors eErrorCode, std::exception& stdException, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction) : - TBaseException(eErrorCode, stdException.what(), pszFile, stLineNumber, pszFunction) - { - } - - // ============================================================================ - /// TCoreWin32Exception::TCoreWin32Exception - /// @date 2011/07/18 - /// - /// @brief Constructs core win32 exception. - /// @param[in] eErrorCode - core error code - /// @param[in] dwWin32Exception - win32 error code - /// @param[in] pszFile -source file where the exception was thrown - /// @param[in] stLineNumber - source code line number where the exception was thrown - /// @param[in] pszFunction - function throwing the exception - // ============================================================================ - TCoreWin32Exception::TCoreWin32Exception(EGeneralErrors eErrorCode, DWORD dwWin32Exception, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction) : - TBaseException(eErrorCode, _T(""), pszFile, stLineNumber, pszFunction), - m_dwWin32ErrorCode(dwWin32Exception) - { - } - - // ============================================================================ - /// TCoreWin32Exception::GetErrorInfo - /// @date 2011/07/18 - /// - /// @brief Retrieves formatted exception information. - /// @param[in] pszBuffer - buffer for formatted string - /// @param[in] stMaxBuffer - max size of buffer - // ============================================================================ - void TCoreWin32Exception::GetErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const - { - _snwprintf_s(pszBuffer, stMaxBuffer, _TRUNCATE, _T("Error code: %ld (win32 error code: %lu)"), m_eErrorCode, m_dwWin32ErrorCode); - pszBuffer[stMaxBuffer - 1] = _T('\0'); - } - - void TCoreWin32Exception::GetDetailedErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const - { - _snwprintf_s(pszBuffer, stMaxBuffer, _TRUNCATE, _T("Error code: %ld\r\nWin32 error code: %lu\r\nFile: %s\r\nFunction: %s\r\nLine no: %lu"), m_eErrorCode, m_dwWin32ErrorCode, m_pszFile, m_pszFunction, (unsigned long)m_stLineNumber); - pszBuffer[stMaxBuffer - 1] = _T('\0'); - } } Index: src/libchcore/TCoreException.h =================================================================== diff -u -N -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r0c48142d3db406c32c05d7afdf77da45b2459b34 --- src/libchcore/TCoreException.h (.../TCoreException.h) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TCoreException.h (.../TCoreException.h) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) @@ -23,45 +23,21 @@ #include "ErrorCodes.h" #include "TBaseException.h" -namespace chcore -{ - // throws core exception object +// throws core exception object #define THROW_CORE_EXCEPTION(error_code)\ - throw TCoreException(error_code, __FILEW__, __LINE__, __FUNCTIONW__) + throw chcore::TCoreException(error_code, L"", __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_MSG(error_code, msg)\ + throw chcore::TCoreException(error_code, msg, __FILEW__, __LINE__, __FUNCTIONW__) -#define THROW_CORE_EXCEPTION_WIN32(error_code, win32_error_code)\ - throw TCoreWin32Exception(error_code, win32_error_code, __FILEW__, __LINE__, __FUNCTIONW__) +namespace chcore +{ class LIBCHCORE_API TCoreException : public TBaseException { public: - TCoreException(EGeneralErrors eErrorCode, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction); - TCoreException(EGeneralErrors eErrorCode, std::exception& stdException, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction); - - private: - TCoreException(); + using TBaseException::TBaseException; }; - - class LIBCHCORE_API TCoreWin32Exception : public TBaseException - { - public: - TCoreWin32Exception(EGeneralErrors eErrorCode, DWORD dwWin32Exception, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction); - - DWORD GetWin32ErrorCode() const { return m_dwWin32ErrorCode; } - - virtual void GetErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const; - virtual void GetDetailedErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const; - - private: - TCoreWin32Exception(); - - protected: - // what happened? - DWORD m_dwWin32ErrorCode; - }; } #endif Index: src/libchcore/TDateTime.cpp =================================================================== diff -u -N -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r0c48142d3db406c32c05d7afdf77da45b2459b34 --- src/libchcore/TDateTime.cpp (.../TDateTime.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TDateTime.cpp (.../TDateTime.cpp) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) @@ -22,7 +22,7 @@ // ============================================================================ #include "stdafx.h" #include "TDateTime.h" -#include "TCoreException.h" +#include "TCoreWin32Exception.h" #include "ErrorCodes.h" namespace chcore Index: src/libchcore/TFakeFileSerializer.cpp =================================================================== diff -u -N -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r0c48142d3db406c32c05d7afdf77da45b2459b34 --- src/libchcore/TFakeFileSerializer.cpp (.../TFakeFileSerializer.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TFakeFileSerializer.cpp (.../TFakeFileSerializer.cpp) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) @@ -39,11 +39,11 @@ ISerializerContainerPtr TFakeFileSerializer::GetContainer(const TString& /*strContainerName*/) { - throw TCoreException(eErr_InvalidSerializer, m_pathFileSerializer.ToString(), __LINE__, __FUNCTIONW__); + throw TCoreException(eErr_InvalidSerializer, L"", m_pathFileSerializer.ToString(), __LINE__, __FUNCTIONW__); } void TFakeFileSerializer::Flush() { - throw TCoreException(eErr_InvalidSerializer, m_pathFileSerializer.ToString(), __LINE__, __FUNCTIONW__); + throw TCoreException(eErr_InvalidSerializer, L"", m_pathFileSerializer.ToString(), __LINE__, __FUNCTIONW__); } } Index: src/libchcore/TSQLiteSerializerFactory.cpp =================================================================== diff -u -N -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r0c48142d3db406c32c05d7afdf77da45b2459b34 --- src/libchcore/TSQLiteSerializerFactory.cpp (.../TSQLiteSerializerFactory.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TSQLiteSerializerFactory.cpp (.../TSQLiteSerializerFactory.cpp) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) @@ -26,7 +26,7 @@ #include "TSQLiteTaskSchema.h" #include "TSQLiteSerializer.h" #include "TSQLiteTaskManagerSchema.h" -#include "TCoreException.h" +#include "TCoreWin32Exception.h" #include "ErrorCodes.h" namespace chcore Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -N -r479ad4e8f81a68cbf6d1623cd9b1f3342d8cfdcc -r0c48142d3db406c32c05d7afdf77da45b2459b34 --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 479ad4e8f81a68cbf6d1623cd9b1f3342d8cfdcc) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) @@ -37,6 +37,7 @@ #include "TFileInfoArray.h" #include "ErrorCodes.h" #include "TCoreException.h" +#include "TCoreWin32Exception.h" #include "TPathContainer.h" #include "TScopedRunningTimeTracker.h" #include "TFeedbackHandlerWrapper.h" Index: src/libchcore/TWorkerThreadController.cpp =================================================================== diff -u -N -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r0c48142d3db406c32c05d7afdf77da45b2459b34 --- src/libchcore/TWorkerThreadController.cpp (.../TWorkerThreadController.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TWorkerThreadController.cpp (.../TWorkerThreadController.cpp) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) @@ -22,7 +22,7 @@ // ============================================================================ #include "stdafx.h" #include "TWorkerThreadController.h" -#include "TCoreException.h" +#include "TCoreWin32Exception.h" #include "ErrorCodes.h" namespace chcore Index: src/libchcore/libchcore.vc140.vcxproj =================================================================== diff -u -N -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r0c48142d3db406c32c05d7afdf77da45b2459b34 --- src/libchcore/libchcore.vc140.vcxproj (.../libchcore.vc140.vcxproj) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/libchcore.vc140.vcxproj (.../libchcore.vc140.vcxproj) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) @@ -521,6 +521,8 @@ + + @@ -650,6 +652,8 @@ + + true true Index: src/libchcore/libchcore.vc140.vcxproj.filters =================================================================== diff -u -N -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r0c48142d3db406c32c05d7afdf77da45b2459b34 --- src/libchcore/libchcore.vc140.vcxproj.filters (.../libchcore.vc140.vcxproj.filters) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/libchcore.vc140.vcxproj.filters (.../libchcore.vc140.vcxproj.filters) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) @@ -75,6 +75,9 @@ {bb686013-810c-4180-9b23-c5fe52df7c93} + + {a77c6575-b7b7-4683-9295-d5173da8c76b} + @@ -149,9 +152,6 @@ Source Files\Tools - - Source Files\Tools - Source Files\Tools @@ -269,9 +269,6 @@ Source Files\Tools - - Source Files\Tools - Source Files\Tools @@ -452,6 +449,18 @@ Source Files\Tools + + Source Files\Tools\Exceptions + + + Source Files\Tools\Exceptions + + + Source Files\Tools\Exceptions + + + Source Files\Tools\Exceptions + @@ -517,9 +526,6 @@ Source Files\Library files - - Source Files\Tools - Source Files\Tools @@ -631,9 +637,6 @@ Source Files\Tools - - Source Files\Tools - Source Files\Tools @@ -829,5 +832,17 @@ Source Files\Filesystems\Fake + + Source Files\Tools\Exceptions + + + Source Files\Tools\Exceptions + + + Source Files\Tools\Exceptions + + + Source Files\Tools\Exceptions + \ No newline at end of file