Index: src/libchcore/ConfigNodeContainer.cpp =================================================================== diff -u -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/ConfigNodeContainer.cpp (.../ConfigNodeContainer.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) +++ src/libchcore/ConfigNodeContainer.cpp (.../ConfigNodeContainer.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -296,9 +296,9 @@ strName.MidSelf(strReplace.GetLength()); size_t stPos = strName.Find(_T("]")); if (stPos == std::numeric_limits::max()) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"] character not found", LOCATION); if (strName.GetAt(stPos + 1) != _T('.')) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L". character not found", LOCATION); size_t stNodeIndex = boost::lexical_cast(strName.Left(stPos)); if (stNodeIndex != stLastIndex) @@ -311,7 +311,7 @@ strName.Delete(0, stPos + 2); // skip "]." at the beginning if (!pCurrentContainer) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"pCurrentContainer", LOCATION); pCurrentContainer->m_mic.insert(ConfigNode(++pCurrentContainer->m_oidLastObjectID, strName, iter->GetOrder(), iter->m_strValue)); } @@ -391,7 +391,7 @@ strCurrentNode.MidSelf(strSearch.GetLength()); size_t stPos = strCurrentNode.Find(_T("]")); if (stPos == std::numeric_limits::max()) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"] character not found", LOCATION); size_t stNumber = boost::lexical_cast(strCurrentNode.Left(stPos).c_str()); stMaxNodeNumber = std::max(stMaxNodeNumber, stNumber + 1); @@ -438,7 +438,7 @@ // sanity check (either unique names or empty or an array with single name size_t stNodeNamesCount = setNodeNames.size(); if (stChildCount != stNodeNamesCount && stNodeNamesCount != 1) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"Tree sanity check failed", LOCATION); enum EMode { eMode_LeafStringArrayEntries, eMode_LeafOrContainer, eMode_ContainerSplit, eMode_ContainerPassThrough }; EMode eMode = eMode_LeafStringArrayEntries; @@ -528,13 +528,13 @@ // there is a bracket in the node name - this element is a part of a hierarchy of similar nodes size_t stSecondBracketPos = strNodeName.Find(_T("]"), stBracketPos + 1); if (stSecondBracketPos == TString::npos) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"] character not found", LOCATION); strGroupNode = strNodeName.Left(stBracketPos); TString strSubnodeName = strNodeName.Mid(stSecondBracketPos + 1); wchar_t chDot = 0; if (!strSubnodeName.GetAt(0, chDot) || chDot != L'.') - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L". character not found", LOCATION); strSubnodeName.Delete(0, 1); size_t stBracketID = boost::lexical_cast(strNodeName.Mid(stBracketPos + 1, stSecondBracketPos - stBracketPos - 1)); Index: src/libchcore/TBaseException.h =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TBaseException.h (.../TBaseException.h) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TBaseException.h (.../TBaseException.h) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -22,6 +22,8 @@ #include "libchcore.h" #include "ErrorCodes.h" +#define LOCATION __FILEW__, __LINE__, __FUNCTIONW__ + namespace chcore { #pragma warning(push) Index: src/libchcore/TBasePathData.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -90,7 +90,7 @@ void TBasePathData::Store(const ISerializerContainerPtr& spContainer) const { if (!spContainer) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spContainer", LOCATION); bool bAdded = m_setModifications[eMod_Added]; if (m_setModifications.any()) @@ -161,7 +161,7 @@ void TBasePathDataContainer::Store(const ISerializerContainerPtr& spContainer) const { if (!spContainer) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spContainer", LOCATION); boost::shared_lock lock(m_lock); @@ -179,7 +179,7 @@ void TBasePathDataContainer::Load(const ISerializerContainerPtr& spContainer) { if (!spContainer) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spContainer", LOCATION); boost::unique_lock lock(m_lock); m_setRemovedObjects.Clear(); @@ -210,7 +210,7 @@ { boost::unique_lock lock(m_lock); if (fcIndex >= m_vEntries.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"fcIndex", LOCATION); m_setRemovedObjects.Add(m_vEntries[boost::numeric_cast(fcIndex)]->GetObjectID()); m_vEntries.erase(m_vEntries.begin() + boost::numeric_cast(fcIndex)); @@ -231,7 +231,7 @@ return spItem; } - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"Object id does not exist", LOCATION); } void TBasePathDataContainer::ClearNL() Index: src/libchcore/TBufferSizes.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TBufferSizes.cpp (.../TBufferSizes.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TBufferSizes.cpp (.../TBufferSizes.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -72,7 +72,7 @@ case eBuffer_LAN: return m_uiLANSize; default: - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"Unsupported buffer type", LOCATION); } } @@ -96,7 +96,7 @@ m_uiLANSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); break; default: - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"Unsupported buffer type", LOCATION); } } Index: src/libchcore/TConfig.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -74,7 +74,7 @@ void TConfig::Read(PCTSTR pszFile) { if (!pszFile) - THROW_CORE_EXCEPTION_MSG(eErr_InvalidArgument, ("pszFile")); + throw TCoreException(eErr_InvalidArgument, L"pszFile", LOCATION); { boost::unique_lock lock(GetImpl()->m_lock); @@ -107,7 +107,7 @@ void TConfig::ReadFromString(const TString& strInput) { if (strInput.IsEmpty()) - THROW_CORE_EXCEPTION_MSG(eErr_InvalidArgument, ("pszFile")); + throw TCoreException(eErr_InvalidArgument, L"pszFile", LOCATION); boost::property_tree::wiptree tPropertyTree; @@ -138,7 +138,7 @@ void TConfig::Store(const ISerializerContainerPtr& spContainer) const { if (!spContainer) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spContainer", LOCATION); boost::shared_lock lock(GetImpl()->m_lock); @@ -168,7 +168,7 @@ void TConfig::Load(const ISerializerContainerPtr& spContainer) const { if (!spContainer) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spContainer", LOCATION); boost::unique_lock lock(GetImpl()->m_lock); m_pImpl->m_setRemovedObjects.Clear(); Index: src/libchcore/TConfigNotifier.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TConfigNotifier.cpp (.../TConfigNotifier.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TConfigNotifier.cpp (.../TConfigNotifier.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -39,7 +39,7 @@ void TConfigNotifier::operator()(const TStringSet& rsetPropNames) { if (!m_pfnCallback) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"m_pfnCallback", LOCATION); (*m_pfnCallback)(rsetPropNames, m_pParam); } Index: src/libchcore/TCoreException.h =================================================================== diff -u -rbfc7a8378a96c5b58def559b343918fca32f05a6 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TCoreException.h (.../TCoreException.h) (revision bfc7a8378a96c5b58def559b343918fca32f05a6) +++ src/libchcore/TCoreException.h (.../TCoreException.h) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -23,13 +23,6 @@ #include "ErrorCodes.h" #include "TBaseException.h" -// throws core exception object -#define THROW_CORE_EXCEPTION(error_code)\ - throw ::chcore::TCoreException(error_code, L"", __FILEW__, __LINE__, __FUNCTIONW__) - -#define THROW_CORE_EXCEPTION_MSG(error_code, msg)\ - throw ::chcore::TCoreException(error_code, msg, __FILEW__, __LINE__, __FUNCTIONW__) - namespace chcore { class LIBCHCORE_API TCoreException : public TBaseException Index: src/libchcore/TDateTime.cpp =================================================================== diff -u -r0c48142d3db406c32c05d7afdf77da45b2459b34 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TDateTime.cpp (.../TDateTime.cpp) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) +++ src/libchcore/TDateTime.cpp (.../TDateTime.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -35,7 +35,7 @@ TDateTime::TDateTime(int iYear, int iMonth, int iDay, int iHour, int iMinute, int iSecond) { if (iYear < 1900) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"iYear", LOCATION); tm tTime; @@ -84,7 +84,7 @@ TDateTime& TDateTime::operator=(SYSTEMTIME sysDateTime) { if (sysDateTime.wYear < 1900) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"sysDateTime.wYear", LOCATION); tm tTime; @@ -124,7 +124,7 @@ tm tThisTimeInfo; errno_t err = _localtime64_s(&tThisTimeInfo, &m_tTime); if (err != 0) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"Reading localtime failed", LOCATION); tSystemTime.wYear = (WORD)(tThisTimeInfo.tm_year + 1900); tSystemTime.wMonth = (WORD)(tThisTimeInfo.tm_mon + 1); @@ -156,10 +156,10 @@ tm tThisTimeInfo; errno_t err = _localtime64_s(&tThisTimeInfo, &m_tTime); if (err != 0) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"Reading local time failed", LOCATION); if (!_tcsftime(pszBuffer, stMaxBufSize, pszFmt, &tThisTimeInfo)) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"Time formatting failed", LOCATION); strTmp.ReleaseBuffer(); return strTmp; @@ -174,10 +174,10 @@ tm tOtherTimeInfo; errno_t err = _localtime64_s(&tThisTimeInfo, &m_tTime); if (err != 0) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"Reading local time failed", LOCATION); err = _localtime64_s(&tOtherTimeInfo, &rOtherDateTime.m_tTime); if (err != 0) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"Reading local time failed", LOCATION); time_t tDiffDateTime = 0; if (bCompareDate) Index: src/libchcore/TEvent.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TEvent.cpp (.../TEvent.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TEvent.cpp (.../TEvent.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -27,7 +27,7 @@ { m_hEvent = CreateEvent(NULL, bManualReset, bInitialState, NULL); if (m_hEvent == NULL) - THROW_CORE_EXCEPTION(eErr_CannotCreateEvent); + throw TCoreException(eErr_CannotCreateEvent, L"Failed to create event", LOCATION); } TEvent::~TEvent() Index: src/libchcore/TFakeFileSerializer.cpp =================================================================== diff -u -r0c48142d3db406c32c05d7afdf77da45b2459b34 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TFakeFileSerializer.cpp (.../TFakeFileSerializer.cpp) (revision 0c48142d3db406c32c05d7afdf77da45b2459b34) +++ src/libchcore/TFakeFileSerializer.cpp (.../TFakeFileSerializer.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -39,11 +39,11 @@ ISerializerContainerPtr TFakeFileSerializer::GetContainer(const TString& /*strContainerName*/) { - throw TCoreException(eErr_InvalidSerializer, L"", m_pathFileSerializer.ToString(), __LINE__, __FUNCTIONW__); + throw TCoreException(eErr_InvalidSerializer, L"GetContainer is unsupported on fake serializer", m_pathFileSerializer.ToString(), __LINE__, __FUNCTIONW__); } void TFakeFileSerializer::Flush() { - throw TCoreException(eErr_InvalidSerializer, L"", m_pathFileSerializer.ToString(), __LINE__, __FUNCTIONW__); + throw TCoreException(eErr_InvalidSerializer, L"Flush is unsupported on fake serializer", m_pathFileSerializer.ToString(), __LINE__, __FUNCTIONW__); } } Index: src/libchcore/TFileInfo.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -131,7 +131,7 @@ { // cannot set parent object if there is already one specified if (m_spBasePathData.Get()) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"m_spBasePathData", LOCATION); m_spBasePathData = spBasePathData; if (m_spBasePathData.Get()) Index: src/libchcore/TFileInfoArray.cpp =================================================================== diff -u -r6c67d46c243c6a275f2a427c991f82db59c63ef0 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TFileInfoArray.cpp (.../TFileInfoArray.cpp) (revision 6c67d46c243c6a275f2a427c991f82db59c63ef0) +++ src/libchcore/TFileInfoArray.cpp (.../TFileInfoArray.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -59,7 +59,7 @@ boost::shared_lock lock(m_lock); if (fcIndex >= m_vFiles.size()) - THROW_CORE_EXCEPTION_MSG(eErr_InvalidArgument, L"fcIndex"); + throw TCoreException(eErr_InvalidArgument, L"fcIndex", LOCATION); return m_vFiles.at(boost::numeric_cast(fcIndex)); } @@ -106,7 +106,7 @@ boost::shared_lock lock(m_lock); if (fcCount > m_vFiles.size()) - THROW_CORE_EXCEPTION_MSG(eErr_InvalidArgument, L"fcIndex"); + throw TCoreException(eErr_InvalidArgument, L"fcIndex", LOCATION); for (std::vector::iterator iter = m_vFiles.begin(); iter != m_vFiles.begin() + boost::numeric_cast(fcCount); ++iter) { Index: src/libchcore/TFilesystemFeedbackWrapper.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TFilesystemFeedbackWrapper.cpp (.../TFilesystemFeedbackWrapper.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TFilesystemFeedbackWrapper.cpp (.../TFilesystemFeedbackWrapper.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -33,7 +33,7 @@ m_rThreadController(rThreadController) { if (!spFilesystem) - THROW_CORE_EXCEPTION_MSG(eErr_InvalidArgument, L"Filesystem not provided"); + throw TCoreException(eErr_InvalidArgument, L"Filesystem not provided", LOCATION); } TSubTaskBase::ESubOperationResult TFilesystemFeedbackWrapper::CreateDirectoryFB(const TSmartPath& pathDirectory) @@ -82,7 +82,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) @@ -151,7 +151,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } } @@ -180,7 +180,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } } @@ -242,7 +242,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) @@ -303,7 +303,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) @@ -368,7 +368,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) @@ -417,7 +417,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) Index: src/libchcore/TFilesystemFileFeedbackWrapper.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TFilesystemFileFeedbackWrapper.cpp (.../TFilesystemFileFeedbackWrapper.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TFilesystemFileFeedbackWrapper.cpp (.../TFilesystemFileFeedbackWrapper.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -34,7 +34,7 @@ m_spFilesystem(spFilesystem) { if(!spFeedbackHandler || !spFilesystem) - THROW_CORE_EXCEPTION_MSG(eErr_InvalidArgument, L"Missing filesystem or feedback handler"); + throw TCoreException(eErr_InvalidArgument, L"Missing filesystem or feedback handler", LOCATION); } TSubTaskBase::ESubOperationResult TFilesystemFileFeedbackWrapper::OpenSourceFileFB(const IFilesystemFilePtr& fileSrc) @@ -93,7 +93,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) @@ -182,7 +182,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) @@ -270,7 +270,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } } @@ -309,7 +309,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) @@ -363,7 +363,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) @@ -419,7 +419,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) @@ -476,7 +476,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) @@ -532,7 +532,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Feedback result unknown", LOCATION); } if(WasKillRequested(frResult)) Index: src/libchcore/TLocalFilesystem.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libchcore/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -187,7 +187,7 @@ void TLocalFilesystem::GetFileInfo(const TSmartPath& pathFile, TFileInfoPtr& spFileInfo, const TBasePathDataPtr& spBasePathData) { if (!spFileInfo) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"spFileInfo", LOCATION); WIN32_FIND_DATA wfd; @@ -246,8 +246,10 @@ TLocalFilesystem::EPathsRelation TLocalFilesystem::GetPathsRelation(const TSmartPath& pathFirst, const TSmartPath& pathSecond) { - if (pathFirst.IsEmpty() || pathSecond.IsEmpty()) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + if (pathFirst.IsEmpty()) + throw TCoreException(eErr_InvalidArgument, L"pathFirst", LOCATION); + if(pathSecond.IsEmpty()) + throw TCoreException(eErr_InvalidArgument, L"pathSecond", LOCATION); // get information about both paths UINT uiFirstDriveType = 0; @@ -269,7 +271,7 @@ wchar_t wchSecondDrive = pathSecond.GetDriveLetter(); if (wchFirstDrive == L'\0' || wchSecondDrive == L'\0') - THROW_CORE_EXCEPTION(eErr_FixedDriveWithoutDriveLetter); + throw TCoreException(eErr_FixedDriveWithoutDriveLetter, L"Fixed drive does not have drive letter assigned", LOCATION); if (wchFirstDrive == wchSecondDrive) eRelation = eRelation_SinglePhysicalDisk; Index: src/libchcore/TLocalFilesystemFile.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TLocalFilesystemFile.cpp (.../TLocalFilesystemFile.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libchcore/TLocalFilesystemFile.cpp (.../TLocalFilesystemFile.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -40,7 +40,7 @@ m_bNoBuffering(bNoBuffering) { if (pathFile.IsEmpty()) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"pathFile", LOCATION); } TLocalFilesystemFile::~TLocalFilesystemFile() Index: src/libchcore/TModPathContainer.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TModPathContainer.cpp (.../TModPathContainer.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TModPathContainer.cpp (.../TModPathContainer.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -114,7 +114,7 @@ const TSmartPath& TModPathContainer::GetAt(size_t stIndex) const { if (stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); DataMap::const_iterator iter = m_vPaths.cbegin() + stIndex; return iter->second; @@ -131,7 +131,7 @@ TSmartPath& TModPathContainer::GetAt(size_t stIndex) { if (stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); DataMap::iterator iter = m_vPaths.begin() + stIndex; return iter->second.Modify(); @@ -140,7 +140,7 @@ object_id_t TModPathContainer::GetOidAt(size_t stIndex) const { if (stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); DataMap::const_iterator iter = m_vPaths.begin() + stIndex; return iter->first; @@ -157,7 +157,7 @@ void TModPathContainer::SetAt(size_t stIndex, const TSmartPath& spPath) { if (stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); DataMap::iterator iter = m_vPaths.begin() + stIndex; iter->second = spPath; @@ -173,7 +173,7 @@ void TModPathContainer::DeleteAt(size_t stIndex) { if (stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); DataMap::iterator iterDel = m_vPaths.begin() + stIndex; m_setRemovedItems.Add(iterDel->first); Index: src/libchcore/TOverlappedDataBuffer.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TOverlappedDataBuffer.cpp (.../TOverlappedDataBuffer.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TOverlappedDataBuffer.cpp (.../TOverlappedDataBuffer.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -74,7 +74,7 @@ m_dwRealDataSize(0) { if (!m_pQueue) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"m_pQueue", LOCATION); // initialize OVERLAPPED members Internal = 0; @@ -100,7 +100,7 @@ m_pBuffer = VirtualAlloc(NULL, stNewBufferSize, MEM_COMMIT, PAGE_READWRITE); if (!m_pBuffer) - THROW_CORE_EXCEPTION(eErr_CannotAllocateMemory); + throw TCoreException(eErr_CannotAllocateMemory, L"VirtualAlloc failed", LOCATION); m_stBufferSize = stNewBufferSize; } } Index: src/libchcore/TOverlappedDataBufferQueue.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TOverlappedDataBufferQueue.cpp (.../TOverlappedDataBufferQueue.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TOverlappedDataBufferQueue.cpp (.../TOverlappedDataBufferQueue.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -83,7 +83,7 @@ void TOverlappedDataBufferQueue::AddEmptyBuffer(TOverlappedDataBuffer* pBuffer) { if (!pBuffer) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"pBuffer", LOCATION); m_listEmptyBuffers.push_back(pBuffer); UpdateReadPossibleEvent(); @@ -126,11 +126,11 @@ void TOverlappedDataBufferQueue::AddFullBuffer(TOverlappedDataBuffer* pBuffer) { if (!pBuffer) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"pBuffer", LOCATION); std::pair pairInsertInfo = m_setFullBuffers.insert(pBuffer); if (!pairInsertInfo.second) - THROW_CORE_EXCEPTION(eErr_InvalidOverlappedPosition); + throw TCoreException(eErr_InvalidOverlappedPosition, L"Tried to re-insert same buffer into queue", LOCATION); if (pBuffer->IsLastPart()) m_bDataSourceFinished = true; @@ -177,11 +177,11 @@ void TOverlappedDataBufferQueue::AddFinishedBuffer(TOverlappedDataBuffer* pBuffer) { if (!pBuffer) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"pBuffer", LOCATION); std::pair pairInsertInfo = m_setFinishedBuffers.insert(pBuffer); if (!pairInsertInfo.second) - THROW_CORE_EXCEPTION(eErr_InvalidOverlappedPosition); + throw TCoreException(eErr_InvalidOverlappedPosition, L"Tried to re-insert same buffer into queue", LOCATION); UpdateWriteFinishedEvent(); UpdateAllBuffersAccountedFor(); @@ -214,9 +214,9 @@ { // sanity check - if any of the buffers are still in use, we can't change the sizes if (m_listAllBuffers.size() != m_listEmptyBuffers.size()) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Some buffers are still in use", LOCATION); if (stBufferSize == 0) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"stBufferSize", LOCATION); if (stBufferSize != GetSingleBufferSize()) { @@ -276,7 +276,7 @@ CleanupBuffers(); if (m_listAllBuffers.size() != m_listEmptyBuffers.size()) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Some buffers are still in use", LOCATION); m_bDataSourceFinished = false; m_bDataWritingFinished = false; Index: src/libchcore/TPath.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TPath.cpp (.../TPath.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TPath.cpp (.../TPath.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -223,7 +223,7 @@ void TSmartPath::FromString(const wchar_t* pszPath) { if (!pszPath) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"pszPath", LOCATION); m_strPath = pszPath; } @@ -909,7 +909,7 @@ TSmartPath PathFromString(const wchar_t* pszPath) { if (!pszPath) - THROW_CORE_EXCEPTION_MSG(eErr_InvalidArgument, ("pszPath")); + throw TCoreException(eErr_InvalidArgument, L"pszPath", LOCATION); TSmartPath spPath; spPath.FromString(pszPath); Index: src/libchcore/TPathContainer.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TPathContainer.cpp (.../TPathContainer.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TPathContainer.cpp (.../TPathContainer.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -101,7 +101,7 @@ const TSmartPath& TPathContainer::GetAt(size_t stIndex) const { if (stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); return m_vPaths.at(stIndex); } @@ -117,7 +117,7 @@ TSmartPath& TPathContainer::GetAt(size_t stIndex) { if (stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); return m_vPaths.at(stIndex); } @@ -133,7 +133,7 @@ void TPathContainer::SetAt(size_t stIndex, const TSmartPath& spPath) { if (stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); m_vPaths[stIndex] = spPath; } @@ -148,7 +148,7 @@ void TPathContainer::DeleteAt(size_t stIndex) { if (stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); m_vPaths.erase(m_vPaths.begin() + stIndex); } Index: src/libchcore/TPlainStringPool.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TPlainStringPool.cpp (.../TPlainStringPool.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TPlainStringPool.cpp (.../TPlainStringPool.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -35,7 +35,7 @@ wchar_t* TPlainStringPool::Alloc(size_t stCount) { if (stCount > BlockSize) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"stCount", LOCATION); // find block where the new string would fit size_t stBlockCount = m_vBlocks.size(); Index: src/libchcore/TRemovedObjects.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TRemovedObjects.cpp (.../TRemovedObjects.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TRemovedObjects.cpp (.../TRemovedObjects.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -44,7 +44,7 @@ object_id_t TRemovedObjects::GetAt(size_t stIndex) const { if (stIndex >= m_setObjects.size()) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"stIndex", LOCATION); std::set::const_iterator iter = m_setObjects.begin(); std::advance(iter, stIndex); Index: src/libchcore/TSQLiteColumnDefinition.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSQLiteColumnDefinition.cpp (.../TSQLiteColumnDefinition.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TSQLiteColumnDefinition.cpp (.../TSQLiteColumnDefinition.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -52,7 +52,7 @@ ++stPos; } - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"Column name not found", LOCATION); } const TString& TSQLiteColumnsDefinition::GetColumnName(size_t stIndex) const Index: src/libchcore/TSQLiteSerializer.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSQLiteSerializer.cpp (.../TSQLiteSerializer.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TSQLiteSerializer.cpp (.../TSQLiteSerializer.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -34,8 +34,10 @@ m_spDatabase(new TSQLiteDatabase(pathDB)), m_spSchema(spSchema) { - if (!m_spDatabase || !m_spSchema) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + if(!m_spDatabase) + throw TCoreException(eErr_InvalidArgument, L"m_spDatabase", LOCATION); + if(!m_spSchema) + throw TCoreException(eErr_InvalidArgument, L"m_spSchema", LOCATION); // initialize db params SetupDBOptions(); @@ -100,10 +102,10 @@ tStatement.Prepare(_T("PRAGMA JOURNAL_MODE=WAL")); TSQLiteStatement::EStepResult eResult = tStatement.Step(); if(eResult != TSQLiteStatement::eStep_HasRow) - THROW_CORE_EXCEPTION(eErr_CannotSetDatabaseOptions); + throw TCoreException(eErr_CannotSetDatabaseOptions, L"Failed to set database options", LOCATION); TString strResult = tStatement.GetText(0); if(strResult != _T("wal")) - THROW_CORE_EXCEPTION(eErr_CannotSetDatabaseOptions);*/ + throw TCoreException(eErr_CannotSetDatabaseOptions, L"Failed to set database options", LOCATION);*/ } } Index: src/libchcore/TSQLiteSerializerRowReader.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSQLiteSerializerRowReader.cpp (.../TSQLiteSerializerRowReader.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TSQLiteSerializerRowReader.cpp (.../TSQLiteSerializerRowReader.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -34,7 +34,7 @@ m_strContainerName(strContainerName) { if (m_strContainerName.IsEmpty()) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"m_strContainerName", LOCATION); } TSQLiteSerializerRowReader::~TSQLiteSerializerRowReader() @@ -44,7 +44,7 @@ bool TSQLiteSerializerRowReader::Next() { if (m_rColumns.IsEmpty()) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"m_rColumns is empty", LOCATION); if (!m_bInitialized) { @@ -63,103 +63,103 @@ void TSQLiteSerializerRowReader::GetValue(const TString& strColName, bool& bValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), bValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, short& iValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), iValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, unsigned short& uiValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), uiValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, int& iValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), iValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, unsigned int& uiValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), uiValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, long& lValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), lValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, unsigned long& ulValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), ulValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, long long& llValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), llValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, unsigned long long& ullValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), ullValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, double& dValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), dValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, TString& strValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), strValue); } void TSQLiteSerializerRowReader::GetValue(const TString& strColName, TSmartPath& pathValue) { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); m_spStatement->GetValue(GetColumnIndex(strColName), pathValue); } int TSQLiteSerializerRowReader::GetColumnIndex(const TString& strColName) const { if (!m_bInitialized) - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Serializer not initialized", LOCATION); size_t stColumn = m_rColumns.GetColumnIndex(strColName.c_str()); return boost::numeric_cast(stColumn); Index: src/libchcore/TSharedMemory.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSharedMemory.cpp (.../TSharedMemory.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libchcore/TSharedMemory.cpp (.../TSharedMemory.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -40,7 +40,7 @@ { DWORD dwRes = WaitForSingleObject(hMutex, 10000); if (dwRes != WAIT_OBJECT_0) - THROW_CORE_EXCEPTION(eErr_MutexTimedOut); + throw TCoreException(eErr_MutexTimedOut, L"Waiting for object failed", LOCATION); } } @@ -72,8 +72,10 @@ void TSharedMemory::Create(const wchar_t* pszName, shm_size_t stSize) { - if (!pszName || pszName[0] == _T('\0') || stSize == 0) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + if(!pszName || pszName[ 0 ] == _T('\0')) + throw TCoreException(eErr_InvalidArgument, L"pszName", LOCATION); + if(stSize == 0) + throw TCoreException(eErr_InvalidArgument, L"stSize", LOCATION); Close(); @@ -84,30 +86,30 @@ SECURITY_DESCRIPTOR secDesc; if (!InitializeSecurityDescriptor(&secDesc, SECURITY_DESCRIPTOR_REVISION)) - THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); + throw TCoreException(eErr_CannotOpenSharedMemory, L"Failed to initialize security descriptor", LOCATION); SECURITY_ATTRIBUTES secAttr; secAttr.nLength = sizeof(secAttr); secAttr.bInheritHandle = FALSE; secAttr.lpSecurityDescriptor = &secDesc; if (!SetSecurityDescriptorDacl(secAttr.lpSecurityDescriptor, TRUE, 0, FALSE)) - THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); + throw TCoreException(eErr_CannotOpenSharedMemory, L"Failed to set dacl", LOCATION); m_hMutex = ::CreateMutex(&secAttr, FALSE, wstrMutexName.c_str()); if (!m_hMutex) - THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); + throw TCoreException(eErr_CannotOpenSharedMemory, L"Failed to create mutex", LOCATION); m_hFileMapping = CreateFileMapping(INVALID_HANDLE_VALUE, &secAttr, PAGE_READWRITE, 0, boost::numeric_cast(stSize + sizeof(size_t)), pszName); if (!m_hFileMapping) - THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); + throw TCoreException(eErr_CannotOpenSharedMemory, L"Failed to create file mapping", LOCATION); else if (GetLastError() == ERROR_ALREADY_EXISTS) - THROW_CORE_EXCEPTION(eErr_SharedMemoryAlreadyExists); // shared memory already exists - cannot guarantee that the size is correct + throw TCoreException(eErr_SharedMemoryAlreadyExists, L"File mapping already exists", LOCATION); // shared memory already exists - cannot guarantee that the size is correct // Get a pointer to the file-mapped shared memory. m_pMappedMemory = (BYTE*)MapViewOfFile(m_hFileMapping, FILE_MAP_WRITE, 0, 0, 0); if (!m_pMappedMemory) - THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); + throw TCoreException(eErr_CannotOpenSharedMemory, L"Cannot map view of file", LOCATION); } catch (...) { @@ -144,12 +146,12 @@ { m_hFileMapping = OpenFileMapping(FILE_MAP_READ, FALSE, pszName); if (!m_hFileMapping) - THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); + throw TCoreException(eErr_CannotOpenSharedMemory, L"Failed to open file mapping", LOCATION); // Get a pointer to the file-mapped shared memory. m_pMappedMemory = (BYTE*)MapViewOfFile(m_hFileMapping, FILE_MAP_READ, 0, 0, 0); if (!m_pMappedMemory) - THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); + throw TCoreException(eErr_CannotOpenSharedMemory, L"Mapping view of file failed", LOCATION); } catch (...) { @@ -193,19 +195,19 @@ void TSharedMemory::Read(TString& wstrData) const { if (!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(shm_size_t)) - THROW_CORE_EXCEPTION(eErr_SharedMemoryNotOpen); + throw TCoreException(eErr_SharedMemoryNotOpen, L"Invalid shared memory state", LOCATION); TMutexLock lock(m_hMutex); shm_size_t stByteSize = *(shm_size_t*)m_pMappedMemory; if ((stByteSize % 2) != 0) - THROW_CORE_EXCEPTION(eErr_SharedMemoryInvalidFormat); + throw TCoreException(eErr_SharedMemoryInvalidFormat, L"Size of shared memory data is odd", LOCATION); const wchar_t* pszRealData = (const wchar_t*)(m_pMappedMemory + sizeof(shm_size_t)); shm_size_t stCharCount = stByteSize / 2; if (pszRealData[stCharCount - 1] != _T('\0')) - THROW_CORE_EXCEPTION(eErr_SharedMemoryInvalidFormat); + throw TCoreException(eErr_SharedMemoryInvalidFormat, L"Shared memory data does not end with \\0", LOCATION); wstrData = pszRealData; } @@ -218,7 +220,7 @@ void TSharedMemory::Write(const BYTE* pbyData, shm_size_t stSize) { if (stSize + sizeof(shm_size_t) > m_stSize) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stSize", LOCATION); TMutexLock lock(m_hMutex); Index: src/libchcore/TSparseRangeMap.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSparseRangeMap.cpp (.../TSparseRangeMap.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TSparseRangeMap.cpp (.../TSparseRangeMap.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -82,7 +82,7 @@ void TSparseRangeMap::GetRangeAt(size_t stIndex, file_size_t& rfsRangeStart, file_size_t& rfsRangeEnd) const { if (stIndex >= m_mapRanges.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); RangeMap::const_iterator iterMap = m_mapRanges.begin(); std::advance(iterMap, stIndex); Index: src/libchcore/TSpeedTracker.cpp =================================================================== diff -u -ra380f7b2ae7d8fe6121e2d0a026b98ee2248c8b5 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSpeedTracker.cpp (.../TSpeedTracker.cpp) (revision a380f7b2ae7d8fe6121e2d0a026b98ee2248c8b5) +++ src/libchcore/TSpeedTracker.cpp (.../TSpeedTracker.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -20,8 +20,10 @@ m_ullLastTimestamp(std::numeric_limits::max()), m_ullZeroIntervalData(0) { - if (m_ullSampleTime == 0 || m_stRequiredSamples == 0) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + if(ullSampleTime == 0) + throw TCoreException(eErr_InvalidArgument, L"ullSampleTime", LOCATION); + if(m_stRequiredSamples == 0) + throw TCoreException(eErr_InvalidArgument, L"m_stRequiredSamples", LOCATION); std::fill_n(std::inserter(m_vSamples, m_vSamples.end()), m_stRequiredSamples, 0.0); } @@ -47,7 +49,7 @@ // sanity check - make sure the data is valid if (ullTimestamp < m_ullLastTimestamp) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"ullTimestamp", LOCATION); // calculate the interval since the time last sample was added unsigned long long ullInterval = ullTimestamp - m_ullLastTimestamp; @@ -213,7 +215,7 @@ const size_t SerializedMembers = 4; if (arrStrings.GetCount() != m_stRequiredSamples + SerializedMembers) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"strData", LOCATION); Clear(); Index: src/libchcore/TString.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TString.cpp (.../TString.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TString.cpp (.../TString.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -407,7 +407,7 @@ // should also copy the terminating null character errno_t err = wmemmove_s(m_pszData + stIndex, stThisLen - stIndex + 1, m_pszData + stIndex + stCountToDelete, stThisLen - stIndex - stCountToDelete + 1); if (err != 0) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Failed to move memory", LOCATION); return bResult; } Index: src/libchcore/TStringArray.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TStringArray.cpp (.../TStringArray.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TStringArray.cpp (.../TStringArray.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -143,23 +143,23 @@ void TStringArray::InsertAt(size_t stIndex, const TString& str) { if (stIndex >= m_vItems.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); m_vItems.insert(m_vItems.begin() + stIndex, str); } void TStringArray::SetAt(size_t stIndex, const TString& str) { if (stIndex >= m_vItems.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); m_vItems[stIndex] = str; } void TStringArray::RemoveAt(size_t stIndex) { if (stIndex >= m_vItems.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); m_vItems.erase(m_vItems.begin() + stIndex); } @@ -172,7 +172,7 @@ const TString& TStringArray::GetAt(size_t stIndex) const { if (stIndex >= m_vItems.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); return m_vItems.at(stIndex); } Index: src/libchcore/TStringPattern.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TStringPattern.cpp (.../TStringPattern.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TStringPattern.cpp (.../TStringPattern.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -36,7 +36,7 @@ break; default: - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Pattern type not supported", LOCATION); } return TString(strPrefix + m_strPattern); @@ -50,7 +50,7 @@ m_strPattern = strSerializedPattern.Mid(3); } else - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Pattern type not supported", LOCATION); } TStringPattern TStringPattern::CreateFromSerializedString(const TString& strSerializedPattern) Index: src/libchcore/TStringPatternArray.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TStringPatternArray.cpp (.../TStringPatternArray.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TStringPatternArray.cpp (.../TStringPatternArray.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -40,23 +40,23 @@ void TStringPatternArray::InsertAt(size_t stIndex, const TStringPattern& strPattern) { if (stIndex > m_vPatterns.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); m_vPatterns.insert(m_vPatterns.begin() + stIndex, strPattern); } void TStringPatternArray::SetAt(size_t stIndex, const TStringPattern& strPattern) { if (stIndex >= m_vPatterns.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); m_vPatterns[stIndex] = strPattern; } void TStringPatternArray::RemoveAt(size_t stIndex) { if (stIndex >= m_vPatterns.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); m_vPatterns.erase(m_vPatterns.begin() + stIndex); } @@ -69,7 +69,7 @@ const TStringPattern& TStringPatternArray::GetAt(size_t stIndex) const { if (stIndex >= m_vPatterns.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); return m_vPatterns[stIndex]; } Index: src/libchcore/TSubTaskArray.cpp =================================================================== diff -u -r3b320bc86d4e808c2f6a70c10bd5c9936102b301 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision 3b320bc86d4e808c2f6a70c10bd5c9936102b301) +++ src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -96,7 +96,7 @@ break; } default: - THROW_CORE_EXCEPTION(eErr_UndefinedOperation); + throw TCoreException(eErr_UndefinedOperation, L"Operation type not known to the engine", LOCATION); } } @@ -107,7 +107,7 @@ for (const std::pair& tupleRow : m_vSubTasks) { if (tupleRow.first == NULL) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"SubTask is null", LOCATION); tupleRow.first->Reset(); } @@ -222,7 +222,7 @@ if (bAdded) { if (m_oidLastStoredIndex != -1) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Last object id is set when array is marked as added", LOCATION); for (size_t stSubOperationIndex = 0; stSubOperationIndex < m_vSubTasks.size(); ++stSubOperationIndex) { @@ -312,7 +312,7 @@ spSubTask->Load(spSerializer); if (boost::numeric_cast(oidID) != m_vSubTasks.size()) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"Object id does not match count of subtasks", LOCATION); m_vSubTasks.push_back(std::make_pair(spSubTask, bIsEstimation)); } @@ -341,7 +341,7 @@ return boost::make_shared(boost::ref(rContext)); default: - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"SubTask is unknown to the engine", LOCATION); } } Index: src/libchcore/TSubTaskBase.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSubTaskBase.cpp (.../TSubTaskBase.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TSubTaskBase.cpp (.../TSubTaskBase.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -50,7 +50,7 @@ IFilesystemPtr spFilesystem = GetContext().GetLocalFilesystem(); if (!spFileInfo) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"spFileInfo", LOCATION); // iFlags: bit 0-ignore folders; bit 1-force creating directories if (iFlags & 0x02) Index: src/libchcore/TSubTaskContext.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSubTaskContext.cpp (.../TSubTaskContext.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TSubTaskContext.cpp (.../TSubTaskContext.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -44,7 +44,7 @@ m_rFilters(rFilters) { if (!spFilesystem) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"spFilesystem", LOCATION); } TSubTaskContext::~TSubTaskContext() Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -123,7 +123,7 @@ { _ASSERTE(rFilesCache.GetSize() == m_tSubTaskStats.GetTotalCount()); if (rFilesCache.GetSize() != m_tSubTaskStats.GetTotalCount()) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Size of files' cache differs from stats information", LOCATION); } // now it's time to check if there is enough space on destination device @@ -266,7 +266,7 @@ return TBufferSizes::eBuffer_Default; if(!spFileInfo) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"spFileInfo", LOCATION); TSmartPath pathSource = spFileInfo->GetFullFilePath(); TSmartPath pathDestination = GetContext().GetDestinationPath(); @@ -377,7 +377,7 @@ { TOverlappedDataBuffer* pBuffer = pData->dbBuffer.GetEmptyBuffer(); if (!pBuffer) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Read was possible, but no buffer is available", LOCATION); pBuffer->InitForRead(ullNextReadPos, dwToRead); ullNextReadPos += dwToRead; @@ -399,7 +399,7 @@ { TOverlappedDataBuffer* pBuffer = pData->dbBuffer.GetFullBuffer(); if (!pBuffer) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Write was possible, but no buffer is available", LOCATION); // was there an error reported? if(pBuffer->GetErrorCode() != ERROR_SUCCESS) @@ -453,7 +453,7 @@ { TOverlappedDataBuffer* pBuffer = pData->dbBuffer.GetFinishedBuffer(); if (!pBuffer) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Write finished was possible, but no buffer is available", LOCATION); if(pBuffer->GetErrorCode() != ERROR_SUCCESS) { @@ -508,7 +508,7 @@ } default: - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Unknown result from async waiting function", LOCATION); } } @@ -530,7 +530,7 @@ { file_size_t fsNewSize = spSrcFile->GetFileSize(); if (fsNewSize == spSrcFileInfo->GetLength64()) - THROW_CORE_EXCEPTION_MSG(eErr_InternalProblem, L"Read more data from file than it really contained. Possible destination file corruption."); + throw TCoreException(eErr_InternalProblem, L"Read more data from file than it really contained. Possible destination file corruption.", LOCATION); m_tSubTaskStats.AdjustTotalSize(spSrcFileInfo->GetLength64(), fsNewSize); spSrcFileInfo->SetLength64(m_tSubTaskStats.GetCurrentItemTotalSize()); @@ -547,10 +547,10 @@ { file_size_t fsNewSize = spSrcFile->GetFileSize(); if (fsNewSize == spSrcFileInfo->GetLength64()) - THROW_CORE_EXCEPTION_MSG(eErr_InternalProblem, L"Read less data from file than it really contained. Possible destination file corruption."); + throw TCoreException(eErr_InternalProblem, L"Read less data from file than it really contained. Possible destination file corruption.", LOCATION); if (fsNewSize != ullCIProcessedSize) - THROW_CORE_EXCEPTION_MSG(eErr_InternalProblem, L"Updated file size still does not match the count of data read. Possible destination file corruption."); + throw TCoreException(eErr_InternalProblem, L"Updated file size still does not match the count of data read. Possible destination file corruption.", LOCATION); m_tSubTaskStats.AdjustTotalSize(ullCITotalSize, fsNewSize); spSrcFileInfo->SetLength64(fsNewSize); @@ -670,9 +670,9 @@ // sanity check if (bDstFileFreshlyCreated && ullSeekTo != 0) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Destination file was freshly created, but seek position is not 0", LOCATION); if(fsMoveTo > ullSeekTo) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"File position to move to is placed after the end of file", LOCATION); // adjust the stats for the difference between what was already processed and what will now be considered processed m_tSubTaskStats.AdjustProcessedSize(ullProcessedSize, fsMoveTo); @@ -764,7 +764,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Unknown feedback result", LOCATION); } } @@ -803,7 +803,7 @@ default: BOOST_ASSERT(FALSE); // unknown result - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Unknown feedback result", LOCATION); } } Index: src/libchcore/TSubTaskStatsInfo.cpp =================================================================== diff -u -rdb818324a61602e118506ca8b3973e44d997c8de -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision db818324a61602e118506ca8b3973e44d997c8de) +++ src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -76,7 +76,7 @@ void TSubTaskStatsInfo::GetSnapshot(TSubTaskStatsSnapshotPtr& spStatsSnapshot) const { if (!spStatsSnapshot) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"spStatsSnapshot", LOCATION); spStatsSnapshot->Clear(); @@ -122,7 +122,7 @@ _ASSERTE(m_fcProcessedCount <= m_fcTotalCount); if (m_fcProcessedCount > m_fcTotalCount) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Count of processed files exceeded the total", LOCATION); } void TSubTaskStatsInfo::SetProcessedCount(file_count_t fcProcessedCount) @@ -135,7 +135,7 @@ _ASSERTE(m_fcProcessedCount <= m_fcTotalCount); if (m_fcProcessedCount > m_fcTotalCount) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Count of processed files exceeded total", LOCATION); } void TSubTaskStatsInfo::SetTotalCount(file_count_t fcCount) @@ -144,7 +144,7 @@ m_fcTotalCount = fcCount; _ASSERTE(m_fcProcessedCount <= m_fcTotalCount); if (m_fcProcessedCount > m_fcTotalCount) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Count of processed files exceeded total", LOCATION); } file_count_t TSubTaskStatsInfo::GetTotalCount() const @@ -162,7 +162,7 @@ _ASSERTE(m_ullProcessedSize <= m_ullTotalSize); if (m_ullProcessedSize > m_ullTotalSize) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Size of processed files exceeded total size", LOCATION); } void TSubTaskStatsInfo::DecreaseProcessedSize(unsigned long long ullDecreaseBy) @@ -175,7 +175,7 @@ _ASSERTE(m_ullProcessedSize <= m_ullTotalSize); if (m_ullProcessedSize > m_ullTotalSize) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Size of processed files exceeded total size", LOCATION); } void TSubTaskStatsInfo::SetProcessedSize(unsigned long long ullProcessedSize) @@ -187,7 +187,7 @@ m_ullProcessedSize = ullProcessedSize; _ASSERTE(m_ullProcessedSize <= m_ullTotalSize); if (m_ullProcessedSize > m_ullTotalSize) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Size of processed files exceeded total size", LOCATION); } void TSubTaskStatsInfo::SetTotalSize(unsigned long long ullTotalSize) @@ -196,7 +196,7 @@ m_ullTotalSize = ullTotalSize; _ASSERTE(m_ullProcessedSize <= m_ullTotalSize); if (m_ullProcessedSize > m_ullTotalSize) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Size of processed files exceeded total size", LOCATION); } // current item @@ -215,7 +215,7 @@ _ASSERTE(m_ullCurrentItemProcessedSize <= m_ullCurrentItemTotalSize); if (m_ullCurrentItemProcessedSize > m_ullCurrentItemTotalSize) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Current file processed size exceeded total size", LOCATION); } bool TSubTaskStatsInfo::WillAdjustProcessedSizeExceedTotalSize(file_size_t fsIncludedProcessedSize, file_size_t fsNewProcessedSize) @@ -426,7 +426,7 @@ boost::unique_lock lock(m_lock); if (m_bIsInitialized) - THROW_CORE_EXCEPTION(eErr_InvalidData); + throw TCoreException(eErr_InvalidData, L"SubTask stats already initialized", LOCATION); m_iCurrentBufferIndex = iCurrentBufferIndex; @@ -435,13 +435,13 @@ _ASSERTE(m_fcProcessedCount <= m_fcTotalCount); if (m_fcProcessedCount > m_fcTotalCount) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Count of processed files exceeded total count", LOCATION); m_ullTotalSize = ullTotalSize; m_ullProcessedSize = ullProcessedSize; _ASSERTE(m_ullProcessedSize <= m_ullTotalSize); if (m_ullProcessedSize > m_ullTotalSize) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Size of processed files exceeded total size", LOCATION); m_strCurrentPath = strCurrentPath; @@ -516,8 +516,8 @@ _ASSERTE(m_ullProcessedSize <= m_ullTotalSize); if (m_ullCurrentItemProcessedSize > m_ullCurrentItemTotalSize) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Current item processed size exceeded total size", LOCATION); if (m_ullProcessedSize > m_ullTotalSize) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Size of processed files exceeded total", LOCATION); } } Index: src/libchcore/TTask.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TTask.cpp (.../TTask.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TTask.cpp (.../TTask.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -39,6 +39,7 @@ #include #include "TTaskConfigBufferSizes.h" #include "log.h" +#include namespace chcore { @@ -57,8 +58,10 @@ m_tSubTasksArray(m_tSubTaskContext), m_spSerializer(spSerializer) { - if (!spFeedbackHandler || !spSerializer) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + if(!spFeedbackHandler) + throw TCoreException(eErr_InvalidArgument, L"spFeedbackHandler", LOCATION); + if(!spSerializer) + throw TCoreException(eErr_InvalidArgument, L"spSerializer", LOCATION); } TTask::~TTask() @@ -350,7 +353,7 @@ void TTask::GetStatsSnapshot(TTaskStatsSnapshotPtr& spSnapshot) { if (!spSnapshot) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"spSnapshot", LOCATION); spSnapshot->Clear(); @@ -391,7 +394,7 @@ spSnapshot->SetCurrentBufferSize(GetTaskPropValue(m_tConfiguration)); break; default: - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Unknown buffer index", LOCATION); //BOOST_ASSERT(false); // assertions are dangerous here, because we're inside critical section // (and there could be conflict with Get(Mini)Snapshot called OnTimer in several places. } @@ -505,6 +508,8 @@ TScopedRunningTimeTracker tProcessingGuard(m_tLocalStats); TFeedbackHandlerWrapperPtr spFeedbackHandler(boost::make_shared(m_spInternalFeedbackHandler, tProcessingGuard)); + const size_t ExceptionBufferSize = 2048; + std::unique_ptr upExceptionInfoBuffer(new wchar_t[ExceptionBufferSize]); try { TSubTaskBase::ESubOperationResult eResult = TSubTaskBase::eSubResult_Continue; @@ -578,7 +583,7 @@ default: BOOST_ASSERT(false); - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Unknown feedback result", LOCATION); } // if the files cache is not completely read - clean it up @@ -600,15 +605,25 @@ return 0; } + catch(const TBaseException& e) + { + e.GetDetailedErrorInfo(upExceptionInfoBuffer.get(), ExceptionBufferSize); + } + catch(const std::exception& e) + { + swprintf_s(upExceptionInfoBuffer.get(), ExceptionBufferSize, L"%S", e.what()); + } catch (...) { + swprintf_s(upExceptionInfoBuffer.get(), ExceptionBufferSize, L"Unspecified error occurred"); } m_tConfiguration.DisconnectFromNotifier(TTaskConfigTracker::NotificationProc); m_tConfiguration.DisconnectFromNotifier(TTask::OnCfgOptionChanged); // log - m_log.loge(_T("Caught exception in ThrdProc")); + TString strMsg = TString(L"Caught exception in ThrdProc: ") + upExceptionInfoBuffer.get(); + m_log.loge(strMsg.c_str()); // let others know some error happened spFeedbackHandler->OperationError(); @@ -659,7 +674,7 @@ { TTask* pTask = (TTask*)pParam; if (!pTask) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"pParam is null, task pointer not provided", LOCATION); if (rsetChanges.HasValue(TaskPropData::GetPropertyName())) { Index: src/libchcore/TTaskBaseData.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TTaskBaseData.cpp (.../TTaskBaseData.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TTaskBaseData.cpp (.../TTaskBaseData.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -120,7 +120,7 @@ spRowReader->GetValue(_T("destination_path"), m_pathDestinationPath.Modify()); } else - THROW_CORE_EXCEPTION(eErr_SerializeLoadError); + throw TCoreException(eErr_SerializeLoadError, L"Reading next row failed", LOCATION); m_setChanges.reset(); } Index: src/libchcore/TTaskConfigTracker.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TTaskConfigTracker.cpp (.../TTaskConfigTracker.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TTaskConfigTracker.cpp (.../TTaskConfigTracker.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -189,7 +189,7 @@ void TTaskConfigTracker::NotificationProc(const TStringSet& setModifications, void* pParam) { if (!pParam) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"pParam", LOCATION); TTaskConfigTracker* pTracker = (TTaskConfigTracker*)pParam; pTracker->AddModified(setModifications); @@ -244,7 +244,7 @@ else { BOOST_ASSERT(false); // unhandled case - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Option name not supported", LOCATION); } // add new elements before this one Index: src/libchcore/TTaskDefinition.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TTaskDefinition.cpp (.../TTaskDefinition.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TTaskDefinition.cpp (.../TTaskDefinition.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -198,13 +198,13 @@ // basic information // source paths to be processed if (!GetConfigValue(rDataSrc, _T("TaskDefinition.SourcePaths.Path"), m_vSourcePaths) || m_vSourcePaths.IsEmpty()) - THROW_CORE_EXCEPTION(eErr_MissingXmlData); + throw TCoreException(eErr_MissingXmlData, L"Missing TaskDefinition.SourcePaths.Path", LOCATION); GetConfigValue(rDataSrc, _T("TaskDefinition.Filters"), m_afFilters); // destination path if (!GetConfigValue(rDataSrc, _T("TaskDefinition.DestinationPath"), m_pathDestinationPath) || (!bAllowEmptyDstPath && m_pathDestinationPath.IsEmpty())) - THROW_CORE_EXCEPTION(eErr_MissingXmlData); + throw TCoreException(eErr_MissingXmlData, L"Missing TaskDefinition.DestinationPath", LOCATION); // append separator only if destination path is already specified; otherwise there are problems handling chext requests with no destination path if (!m_pathDestinationPath.IsEmpty()) @@ -213,13 +213,13 @@ // type of the operation int iOperation = eOperation_None; if (!rDataSrc.GetValue(_T("TaskDefinition.OperationType"), iOperation)) - THROW_CORE_EXCEPTION(eErr_MissingXmlData); + throw TCoreException(eErr_MissingXmlData, L"Missing TaskDefinition.OperationType", LOCATION); m_tOperationPlan.SetOperationType((EOperationType)iOperation); // and version of the task if (!GetConfigValue(rDataSrc, _T("TaskDefinition.Version"), m_ullTaskVersion)) - THROW_CORE_EXCEPTION(eErr_MissingXmlData); + throw TCoreException(eErr_MissingXmlData, L"Missing TaskDefinition.Version", LOCATION); if (m_ullTaskVersion < CURRENT_TASK_VERSION) { @@ -231,7 +231,7 @@ m_bModified = true; } else if (m_ullTaskVersion > CURRENT_TASK_VERSION) - THROW_CORE_EXCEPTION(eErr_UnsupportedVersion); + throw TCoreException(eErr_UnsupportedVersion, L"Task version unsupported", LOCATION); rDataSrc.ExtractSubConfig(_T("TaskDefinition.TaskSettings"), m_tConfiguration); } Index: src/libchcore/TTaskInfo.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TTaskInfo.cpp (.../TTaskInfo.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libchcore/TTaskInfo.cpp (.../TTaskInfo.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -150,7 +150,7 @@ void TTaskInfoContainer::RemoveAt(size_t stIndex) { if (stIndex >= m_vTaskInfos.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); std::vector::iterator iter = m_vTaskInfos.begin() + stIndex; object_id_t oidTaskID = (*iter).GetObjectID(); @@ -170,15 +170,15 @@ TTaskInfoEntry& TTaskInfoContainer::GetAt(size_t stIndex) { if (stIndex >= m_vTaskInfos.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); return m_vTaskInfos[stIndex]; } const TTaskInfoEntry& TTaskInfoContainer::GetAt(size_t stIndex) const { if (stIndex >= m_vTaskInfos.size()) - THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + throw TCoreException(eErr_BoundsExceeded, L"stIndex", LOCATION); return m_vTaskInfos[stIndex]; } @@ -255,7 +255,7 @@ return *iter; } - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"Object id does not exist", LOCATION); } void TTaskInfoContainer::InitColumns(const ISerializerContainerPtr& spContainer) const Index: src/libchcore/TTaskManager.cpp =================================================================== diff -u -rf49b990b02af82798b59d35fec2374d23c6bb053 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TTaskManager.cpp (.../TTaskManager.cpp) (revision f49b990b02af82798b59d35fec2374d23c6bb053) +++ src/libchcore/TTaskManager.cpp (.../TTaskManager.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -41,8 +41,10 @@ m_spFeedbackFactory(spFeedbackHandlerFactory), m_pathLogDir(pathLogDir) { - if (!spFeedbackHandlerFactory || !spSerializerFactory) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + if(!spFeedbackHandlerFactory) + throw TCoreException(eErr_InvalidPointer, L"spFeedbackHandlerFactory", LOCATION); + if(!spSerializerFactory) + throw TCoreException(eErr_InvalidPointer, L"spSerializerFactory", LOCATION); m_spSerializer = m_spSerializerFactory->CreateTaskManagerSerializer(bForceRecreateSerializer); } @@ -79,7 +81,7 @@ TTaskPtr spTask = rEntry.GetTask(); if (spTask->GetTaskName() == tTaskDefinition.GetTaskName()) - THROW_CORE_EXCEPTION(eErr_TaskAlreadyExists); + throw TCoreException(eErr_TaskAlreadyExists, L"Task with specified name already exist", LOCATION); } return CreateTask(tTaskDefinition); @@ -116,7 +118,7 @@ void TTaskManager::Add(const TTaskPtr& spNewTask) { if (!spNewTask) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"spNewTask", LOCATION); boost::unique_lock lock(m_lock); @@ -160,7 +162,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); // delete only when the thread is finished ETaskCurrentState eState = spTask->GetTaskState(); @@ -192,7 +194,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); // delete only when the thread is finished if (spTask == spSelTask) @@ -240,7 +242,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); // turn on some thread - find something with wait state if (spTask->GetTaskState() == eTaskState_Waiting) @@ -261,7 +263,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); spTask->BeginProcessing(); } } @@ -274,7 +276,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); spTask->PauseProcessing(); } } @@ -287,7 +289,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); spTask->ResumeProcessing(); } } @@ -300,7 +302,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); spTask->RestartProcessing(); } } @@ -314,7 +316,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); if (spTask->RetryProcessing()) bChanged = true; } @@ -330,7 +332,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); spTask->CancelProcessing(); } } @@ -349,7 +351,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); ETaskCurrentState eState = spTask->GetTaskState(); bFlag = (eState == eTaskState_Finished || eState == eTaskState_Cancelled || eState == eTaskState_Paused || eState == eTaskState_Error || eState == eTaskState_LoadError); @@ -365,7 +367,7 @@ void TTaskManager::GetStatsSnapshot(TTaskManagerStatsSnapshotPtr& spSnapshot) const { if (!spSnapshot) - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"spSnapshot", LOCATION); spSnapshot->Clear(); @@ -377,7 +379,7 @@ const TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); TTaskStatsSnapshotPtr spStats(new TTaskStatsSnapshot); spTask->GetStatsSnapshot(spStats); @@ -405,7 +407,7 @@ const TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); if (spTask->IsRunning() && spTask->GetTaskState() == eTaskState_Processing) ++stRunningTasks; @@ -422,7 +424,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); spTask->RequestStopThread(); } @@ -432,7 +434,7 @@ TTaskInfoEntry& rEntry = m_tTasks.GetAt(stIndex); TTaskPtr spTask = rEntry.GetTask(); if (!spTask) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); + throw TCoreException(eErr_InvalidPointer, L"spTask", LOCATION); spTask->KillThread(); } } @@ -478,7 +480,7 @@ boost::unique_lock lock(m_lock); if (!m_tTasks.IsEmpty()) - THROW_CORE_EXCEPTION(eErr_InternalProblem); + throw TCoreException(eErr_InternalProblem, L"Task list not empty when trying to load", LOCATION); ISerializerContainerPtr spContainer = m_spSerializer->GetContainer(_T("tasks")); m_tTasks.Load(spContainer); Index: src/libchcore/TTaskOperationPlan.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TTaskOperationPlan.cpp (.../TTaskOperationPlan.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libchcore/TTaskOperationPlan.cpp (.../TTaskOperationPlan.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -68,7 +68,7 @@ switch (eOperation) { case eOperation_None: - THROW_CORE_EXCEPTION(eErr_InvalidArgument); + throw TCoreException(eErr_InvalidArgument, L"eOperation", LOCATION); break; case eOperation_Copy: @@ -93,7 +93,7 @@ BOOST_STATIC_ASSERT(eOperation_Move == eOperation_Max - 1); default: - THROW_CORE_EXCEPTION(eErr_UnhandledCase); + throw TCoreException(eErr_UnhandledCase, L"Unknown operation type", LOCATION); } m_eOperation = eOperation; Index: src/libchcore/TWorkerThreadController.cpp =================================================================== diff -u -r89f857792bba8752de98ddd477949e45cef5ba5a -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/TWorkerThreadController.cpp (.../TWorkerThreadController.cpp) (revision 89f857792bba8752de98ddd477949e45cef5ba5a) +++ src/libchcore/TWorkerThreadController.cpp (.../TWorkerThreadController.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -55,7 +55,7 @@ RemoveZombieData(lock); if (m_hThread) - THROW_CORE_EXCEPTION(eErr_ThreadAlreadyStarted); + throw TCoreException(eErr_ThreadAlreadyStarted, L"Thread was already started", LOCATION); // just in case reset the kill event to avoid early death of the thread to be created if (!::ResetEvent(m_hKillThread)) Index: src/libchcore/log.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -re8f31b0f922b402878356e130c866c4f3682a7f5 --- src/libchcore/log.cpp (.../log.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/log.cpp (.../log.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) @@ -81,7 +81,7 @@ // try to open a file FILE* pFile = _tfopen(pszPath, bClean ? _T("w") : _T("a")); if (pFile == NULL) - THROW_CORE_EXCEPTION_MSG(eErr_CannotOpenFile, L"Could not open the specified file"); + throw TCoreException(eErr_CannotOpenFile, L"Could not open the specified file", LOCATION); fclose(pFile); }