From a1c91f4695e208d5a8f80dc37b1818169b7829ff Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:24:59 +0200 Subject: 5.17 --- lib/ShadowCopy/shadow.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'lib/ShadowCopy/shadow.cpp') diff --git a/lib/ShadowCopy/shadow.cpp b/lib/ShadowCopy/shadow.cpp index 4f6881ad..e915663f 100644 --- a/lib/ShadowCopy/shadow.cpp +++ b/lib/ShadowCopy/shadow.cpp @@ -75,7 +75,7 @@ std::wstring formatVssError(HRESULT hr) //at least the one's from IVssBackupComp } -shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw ComError +shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw SysError { ComPtr backupComp; { @@ -83,13 +83,13 @@ shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw ComError if (FAILED(hr)) { if (hr == E_ACCESSDENIED) - throw ComError(L"The caller does not have sufficient backup privileges or is not an administrator.", hr); - throw ComError(L"Error calling \"CreateVssBackupComponents\".", hr); + throw SysError(formatComError(L"The caller does not have sufficient backup privileges or is not an administrator.", hr)); + throw SysError(formatComError(L"Error calling \"CreateVssBackupComponents\".", hr)); } } - ZEN_COM_CHECK(backupComp->InitializeForBackup()); //throw ComError - ZEN_COM_CHECK(backupComp->SetBackupState(false, false, VSS_BT_FULL)); //throw ComError + ZEN_COM_CHECK(backupComp->InitializeForBackup()); //throw SysError + ZEN_COM_CHECK(backupComp->SetBackupState(false, false, VSS_BT_FULL)); //throw SysError auto waitForComFuture = [](IVssAsync& fut) { @@ -98,7 +98,7 @@ shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw ComError HRESULT hr = S_OK; ZEN_COM_CHECK(fut.QueryStatus(&hr, nullptr)); //check if the async operation succeeded... if (FAILED(hr)) - throw ComError(L"Error calling \"fut->QueryStatus\".", hr); + throw SysError(formatComError(L"Error calling \"fut->QueryStatus\".", hr)); }; ComPtr gatherAsync; @@ -117,12 +117,12 @@ shadow::ShadowData createShadowCopy(const wchar_t* volumeName) //throw ComError if (FAILED(hr)) { if (hr == VSS_E_VOLUME_NOT_SUPPORTED) - throw ComError(L"Volume Shadow Copy Service is not supported on this volume!"); + throw SysError(L"Volume Shadow Copy Service is not supported on this volume!"); const std::wstring vssError = formatVssError(hr); if (!vssError.empty()) - throw ComError(L"Error calling \"backupComp->AddToSnapshotSet\": " + vssError); + throw SysError(L"Error calling \"backupComp->AddToSnapshotSet\": " + vssError); else - throw ComError(L"Error calling \"backupComp->AddToSnapshotSet\".", hr); + throw SysError(formatComError(L"Error calling \"backupComp->AddToSnapshotSet\".", hr)); } } @@ -151,10 +151,10 @@ shadow::ShadowHandle shadow::createShadowCopy(const wchar_t* volumeName) { try { - ShadowData result = ::createShadowCopy(volumeName); //throw ComError + ShadowData result = ::createShadowCopy(volumeName); //throw SysError return new ShadowData(result); //shadow handle owned by caller! std::bad_alloc? } - catch (const zen::ComError& e) + catch (const zen::SysError& e) { lastErrorMessage.reset(new std::wstring(e.toString())); return nullptr; -- cgit