Changeset 73003 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Jul 9, 2018 11:09:32 AM (7 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r72476 r73003 490 490 throw setError(VBOX_E_NOT_SUPPORTED, 491 491 tr("Cannot handle medium attachment: channel is %d, device is %d"), lChannel, lDevice); 492 break;492 break; 493 493 494 494 case StorageBus_SATA: 495 495 lChannelVsys = lChannel; // should be between 0 and 29 496 496 lControllerVsys = lSATAControllerIndex; 497 break;497 break; 498 498 499 499 case StorageBus_SCSI: … … 501 501 lChannelVsys = lChannel; // should be between 0 and 15 502 502 lControllerVsys = lSCSIControllerIndex; 503 break;503 break; 504 504 505 505 case StorageBus_Floppy: 506 506 lChannelVsys = 0; 507 507 lControllerVsys = 0; 508 break;508 break; 509 509 510 510 default: … … 512 512 tr("Cannot handle medium attachment: storageBus is %d, channel is %d, device is %d"), 513 513 storageBus, lChannel, lDevice); 514 break;515 514 } 516 515 -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r72919 r73003 1843 1843 vrc = RTCrX509CertPathsSetTrustedStore(hCertPaths, hTrustedCerts); 1844 1844 if (RT_FAILURE(vrc)) 1845 hrc2 = setError (E_FAIL, tr("RTCrX509CertPathsSetTrustedStore failed (%Rrc)"), vrc);1845 hrc2 = setErrorBoth(E_FAIL, vrc, tr("RTCrX509CertPathsSetTrustedStore failed (%Rrc)"), vrc); 1846 1846 RTCrStoreRelease(hTrustedCerts); 1847 1847 } 1848 1848 else 1849 hrc2 = setError (E_FAIL,1850 tr("Failed to query trusted CAs and Certificates from the system and for the current user (%Rrc, %s)"),1851 vrc, StaticErrInfo.Core.pszMsg);1849 hrc2 = setErrorBoth(E_FAIL, vrc, 1850 tr("Failed to query trusted CAs and Certificates from the system and for the current user (%Rrc, %s)"), 1851 vrc, StaticErrInfo.Core.pszMsg); 1852 1852 1853 1853 /* Add untrusted intermediate certificates. */ … … 1913 1913 } 1914 1914 else 1915 hrc2 = setError (E_FAIL, tr("Certificate path validation failed (%Rrc, %s)"),1916 vrc, StaticErrInfo.Core.pszMsg);1915 hrc2 = setErrorBoth(E_FAIL, vrc, tr("Certificate path validation failed (%Rrc, %s)"), 1916 vrc, StaticErrInfo.Core.pszMsg); 1917 1917 } 1918 1918 else 1919 hrc2 = setError (E_FAIL, tr("Certificate path building failed (%Rrc, %s)"),1920 vrc, StaticErrInfo.Core.pszMsg);1919 hrc2 = setErrorBoth(E_FAIL, vrc, tr("Certificate path building failed (%Rrc, %s)"), 1920 vrc, StaticErrInfo.Core.pszMsg); 1921 1921 } 1922 1922 RTCrX509CertPathsRelease(hCertPaths); … … 2239 2239 NULL /*pszAttr*/, szDigest, fType); 2240 2240 if (RT_FAILURE(vrc)) 2241 return setError (VBOX_E_IPRT_ERROR, tr("Error fudging missing OVF digest in manifest: %Rrc"), vrc);2241 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Error fudging missing OVF digest in manifest: %Rrc"), vrc); 2242 2242 } 2243 2243 -
trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp
r69500 r73003 258 258 { 259 259 RTNETADDRIPV4 IPAddress, NetworkMask, LowerIP, UpperIP; 260 int rc; 261 262 rc = RTNetStrToIPv4Addr(aIPAddress.c_str(), &IPAddress); 263 if (RT_FAILURE(rc)) 264 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, 265 "Invalid server address"); 266 267 rc = RTNetStrToIPv4Addr(aNetworkMask.c_str(), &NetworkMask); 268 if (RT_FAILURE(rc)) 269 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, 270 "Invalid netmask"); 271 272 rc = RTNetStrToIPv4Addr(aLowerIP.c_str(), &LowerIP); 273 if (RT_FAILURE(rc)) 274 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, 275 "Invalid range lower address"); 276 277 rc = RTNetStrToIPv4Addr(aUpperIP.c_str(), &UpperIP); 278 if (RT_FAILURE(rc)) 279 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, 280 "Invalid range upper address"); 260 261 int vrc = RTNetStrToIPv4Addr(aIPAddress.c_str(), &IPAddress); 262 if (RT_FAILURE(vrc)) 263 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, "Invalid server address"); 264 265 vrc = RTNetStrToIPv4Addr(aNetworkMask.c_str(), &NetworkMask); 266 if (RT_FAILURE(vrc)) 267 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, "Invalid netmask"); 268 269 vrc = RTNetStrToIPv4Addr(aLowerIP.c_str(), &LowerIP); 270 if (RT_FAILURE(vrc)) 271 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, "Invalid range lower address"); 272 273 vrc = RTNetStrToIPv4Addr(aUpperIP.c_str(), &UpperIP); 274 if (RT_FAILURE(vrc)) 275 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, "Invalid range upper address"); 281 276 282 277 /* … … 284 279 * here or address/prefix for aIPAddress? 285 280 */ 286 rc = RTNetMaskToPrefixIPv4(&NetworkMask, NULL); 287 if (RT_FAILURE(rc)) 288 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, 289 "Invalid netmask"); 281 vrc = RTNetMaskToPrefixIPv4(&NetworkMask, NULL); 282 if (RT_FAILURE(vrc)) 283 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, "Invalid netmask"); 290 284 291 285 /* It's more convenient to convert to host order once */ … … 301 295 || (IPAddress.u & ~NetworkMask.u) == 0 302 296 || ((IPAddress.u & ~NetworkMask.u) | NetworkMask.u) == UINT32_C(0xffffffff)) 303 { 304 return mVirtualBox->setError(E_INVALIDARG, 305 "Invalid server address"); 306 } 297 return mVirtualBox->setError(E_INVALIDARG, "Invalid server address"); 307 298 308 299 if ( (LowerIP.u & UINT32_C(0xe0000000)) == UINT32_C(0xe0000000) … … 310 301 || (LowerIP.u & ~NetworkMask.u) == 0 311 302 || ((LowerIP.u & ~NetworkMask.u) | NetworkMask.u) == UINT32_C(0xffffffff)) 312 { 313 return mVirtualBox->setError(E_INVALIDARG, 314 "Invalid range lower address"); 315 } 303 return mVirtualBox->setError(E_INVALIDARG, "Invalid range lower address"); 316 304 317 305 if ( (UpperIP.u & UINT32_C(0xe0000000)) == UINT32_C(0xe0000000) … … 319 307 || (UpperIP.u & ~NetworkMask.u) == 0 320 308 || ((UpperIP.u & ~NetworkMask.u) | NetworkMask.u) == UINT32_C(0xffffffff)) 321 { 322 return mVirtualBox->setError(E_INVALIDARG, 323 "Invalid range upper address"); 324 } 309 return mVirtualBox->setError(E_INVALIDARG, "Invalid range upper address"); 325 310 326 311 /* The range should be valid ... */ 327 312 if (LowerIP.u > UpperIP.u) 328 return mVirtualBox->setError(E_INVALIDARG, 329 "Invalid range bounds"); 313 return mVirtualBox->setError(E_INVALIDARG, "Invalid range bounds"); 330 314 331 315 /* ... and shouldn't contain the server's address */ 332 316 if (LowerIP.u <= IPAddress.u && IPAddress.u <= UpperIP.u) 333 return mVirtualBox->setError(E_INVALIDARG, 334 "Server address within range bounds"); 317 return mVirtualBox->setError(E_INVALIDARG, "Server address within range bounds"); 335 318 336 319 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 416 399 { 417 400 uint8_t u8Code; 401 char *pszNext; 402 int vrc = RTStrToUInt8Ex(aValue.c_str(), &pszNext, 10, &u8Code); 403 if (!RT_SUCCESS(vrc)) 404 return VERR_PARSE_ERROR; 405 418 406 uint32_t u32Enc; 419 char *pszNext;420 int rc;421 422 rc = RTStrToUInt8Ex(aValue.c_str(), &pszNext, 10, &u8Code);423 if (!RT_SUCCESS(rc))424 return VERR_PARSE_ERROR;425 426 407 switch (*pszNext) 427 408 { … … 440 421 case '@': 441 422 { 442 rc = RTStrToUInt32Ex(pszNext + 1, &pszNext, 10, &u32Enc);443 if (!RT_SUCCESS( rc))423 vrc = RTStrToUInt32Ex(pszNext + 1, &pszNext, 10, &u32Enc); 424 if (!RT_SUCCESS(vrc)) 444 425 return VERR_PARSE_ERROR; 445 426 if (*pszNext != '=') -
trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
r72980 r73003 474 474 mCaptureFilename = aCaptureFilename; 475 475 alock.release(); 476 int rc = mUSBProxyBackend->captureDevice(this);477 if (RT_FAILURE( rc))476 int vrc = mUSBProxyBackend->captureDevice(this); 477 if (RT_FAILURE(vrc)) 478 478 { 479 479 alock.acquire(); 480 480 i_failTransition(kHostUSBDeviceState_Invalid); 481 481 mMachine.setNull(); 482 if ( rc == VERR_SHARING_VIOLATION)483 return setError (E_FAIL,484 tr("USB device '%s' with UUID {%RTuuid} is in use by someone else"),485 mName, mId.raw());482 if (vrc == VERR_SHARING_VIOLATION) 483 return setErrorBoth(E_FAIL, vrc, 484 tr("USB device '%s' with UUID {%RTuuid} is in use by someone else"), 485 mName, mId.raw()); 486 486 return E_FAIL; 487 487 } -
trunk/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
r69500 r73003 184 184 PFNVBOXHOSTWEBCAMLIST pfn = NULL; 185 185 RTLDRMOD hmod = NIL_RTLDRMOD; 186 int rc = loadHostWebcamLibrary(strLibrary.c_str(), &hmod, &pfn);187 188 LogRel(("Load [%s] rc %Rrc\n", strLibrary.c_str(),rc));189 190 if (RT_SUCCESS( rc))186 int vrc = loadHostWebcamLibrary(strLibrary.c_str(), &hmod, &pfn); 187 188 LogRel(("Load [%s] vrc=%Rrc\n", strLibrary.c_str(), vrc)); 189 190 if (RT_SUCCESS(vrc)) 191 191 { 192 192 uint64_t u64Result = S_OK; 193 rc = pfn(hostWebcamAdd, pList, &u64Result);194 Log(("VBoxHostWebcamList rc %Rrc, result 0x%08X\n",rc, u64Result));195 if (RT_FAILURE( rc))193 vrc = pfn(hostWebcamAdd, pList, &u64Result); 194 Log(("VBoxHostWebcamList vrc %Rrc, result 0x%08X\n", vrc, u64Result)); 195 if (RT_FAILURE(vrc)) 196 196 { 197 197 hr = (HRESULT)u64Result; … … 204 204 if (SUCCEEDED(hr)) 205 205 { 206 if (RT_FAILURE(rc)) 207 hr = pVirtualBox->setError(VBOX_E_IPRT_ERROR, 208 "Failed to get webcam list: %Rrc", rc); 206 if (RT_FAILURE(vrc)) 207 hr = pVirtualBox->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, "Failed to get webcam list: %Rrc", vrc); 209 208 } 210 209 } -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r72919 r73003 641 641 int vrc1 = mParent->i_calculateFullPath(strConfigFile, mData->m_strConfigFileFull); 642 642 if (RT_FAILURE(vrc1)) 643 return setError (VBOX_E_FILE_ERROR,644 tr("Invalid machine settings file name '%s' (%Rrc)"),645 strConfigFile.c_str(),646 vrc1);643 return setErrorBoth(VBOX_E_FILE_ERROR, vrc1, 644 tr("Invalid machine settings file name '%s' (%Rrc)"), 645 strConfigFile.c_str(), 646 vrc1); 647 647 648 648 LogFlowThisFuncLeave(); … … 680 680 int vrc2 = RTFileDelete(mData->m_strConfigFileFull.c_str()); 681 681 if (RT_FAILURE(vrc2)) 682 rc = setError (VBOX_E_FILE_ERROR,683 tr("Could not delete the existing settings file '%s' (%Rrc)"),684 mData->m_strConfigFileFull.c_str(), vrc2);682 rc = setErrorBoth(VBOX_E_FILE_ERROR, vrc2, 683 tr("Could not delete the existing settings file '%s' (%Rrc)"), 684 mData->m_strConfigFileFull.c_str(), vrc2); 685 685 } 686 686 } … … 688 688 && vrc != VERR_PATH_NOT_FOUND 689 689 ) 690 rc = setError (VBOX_E_FILE_ERROR,691 tr("Invalid machine settings file name '%s' (%Rrc)"),692 mData->m_strConfigFileFull.c_str(),693 vrc);690 rc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, 691 tr("Invalid machine settings file name '%s' (%Rrc)"), 692 mData->m_strConfigFileFull.c_str(), 693 vrc); 694 694 return rc; 695 695 } … … 2664 2664 strSnapshotFolder); 2665 2665 if (RT_FAILURE(vrc)) 2666 return setError (E_FAIL,2667 tr("Invalid snapshot folder '%s' (%Rrc)"),2668 strSnapshotFolder.c_str(), vrc);2666 return setErrorBoth(E_FAIL, vrc, 2667 tr("Invalid snapshot folder '%s' (%Rrc)"), 2668 strSnapshotFolder.c_str(), vrc); 2669 2669 2670 2670 i_setModified(IsModified_MachineData); … … 4866 4866 case DeviceType_DVD: 4867 4867 case DeviceType_Floppy: 4868 break;4868 break; 4869 4869 4870 4870 default: … … 5493 5493 int vrc = RTFileDelete(strFile.c_str()); 5494 5494 if (RT_FAILURE(vrc)) 5495 throw setError (VBOX_E_IPRT_ERROR,5496 tr("Could not delete file '%s' (%Rrc)"), strFile.c_str(), vrc);5495 throw setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 5496 tr("Could not delete file '%s' (%Rrc)"), strFile.c_str(), vrc); 5497 5497 } 5498 5498 … … 6520 6520 *aEnabled = TRUE; 6521 6521 #endif 6522 return setError (VBOX_E_IPRT_ERROR,6523 tr("Saved guest size is not available (%Rrc)"),6524 vrc);6522 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6523 tr("Saved guest size is not available (%Rrc)"), 6524 vrc); 6525 6525 } 6526 6526 … … 6557 6557 6558 6558 if (RT_FAILURE(vrc)) 6559 return setError (VBOX_E_IPRT_ERROR,6560 tr("Saved thumbnail data is not available (%Rrc)"),6561 vrc);6559 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6560 tr("Saved thumbnail data is not available (%Rrc)"), 6561 vrc); 6562 6562 6563 6563 HRESULT hr = S_OK; … … 6615 6615 } 6616 6616 else 6617 hr = setError (VBOX_E_IPRT_ERROR,6618 tr("Could not convert saved thumbnail to PNG (%Rrc)"),6619 vrc);6617 hr = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6618 tr("Could not convert saved thumbnail to PNG (%Rrc)"), 6619 vrc); 6620 6620 6621 6621 RTMemFree(pu8PNG); … … 6646 6646 6647 6647 if (RT_FAILURE(vrc)) 6648 return setError (VBOX_E_IPRT_ERROR,6649 tr("Saved screenshot data is not available (%Rrc)"),6650 vrc);6648 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6649 tr("Saved screenshot data is not available (%Rrc)"), 6650 vrc); 6651 6651 6652 6652 *aWidth = u32Width; … … 6682 6682 6683 6683 if (RT_FAILURE(vrc)) 6684 return setError (VBOX_E_IPRT_ERROR,6685 tr("Saved screenshot thumbnail data is not available (%Rrc)"),6686 vrc);6684 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6685 tr("Saved screenshot thumbnail data is not available (%Rrc)"), 6686 vrc); 6687 6687 6688 6688 *aWidth = u32Width; … … 6828 6828 aData.resize(cbData); 6829 6829 else 6830 rc = setError(VBOX_E_IPRT_ERROR, 6831 tr("Could not read log file '%s' (%Rrc)"), 6830 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6831 tr("Could not read log file '%s' (%Rrc)"), 6832 log.c_str(), vrc); 6833 RTFileClose(LogFile); 6834 } 6835 else 6836 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6837 tr("Could not open log file '%s' (%Rrc)"), 6832 6838 log.c_str(), vrc); 6833 RTFileClose(LogFile);6834 }6835 else6836 rc = setError(VBOX_E_IPRT_ERROR,6837 tr("Could not open log file '%s' (%Rrc)"),6838 log.c_str(), vrc);6839 6839 6840 6840 if (FAILED(rc)) … … 7950 7950 7951 7951 if (RT_FAILURE(vrc)) 7952 return setError (VBOX_E_IPRT_ERROR,7953 tr("Could not launch a process for the machine '%s' (%Rrc)"),7954 mUserData->s.strName.c_str(), vrc);7952 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 7953 tr("Could not launch a process for the machine '%s' (%Rrc)"), 7954 mUserData->s.strName.c_str(), vrc); 7955 7955 7956 7956 LogFlowThisFunc(("launched.pid=%d(0x%x)\n", pid, pid)); … … 8150 8150 i_getName().c_str(), status.iStatus, strExtraInfo.c_str()); 8151 8151 else 8152 rc = setError (E_FAIL,8153 tr("The virtual machine '%s' has terminated unexpectedly during startup (%Rrc)%s"),8154 i_getName().c_str(), vrc, strExtraInfo.c_str());8152 rc = setErrorBoth(E_FAIL, vrc, 8153 tr("The virtual machine '%s' has terminated unexpectedly during startup (%Rrc)%s"), 8154 i_getName().c_str(), vrc, strExtraInfo.c_str()); 8155 8155 } 8156 8156 … … 8856 8856 int vrc = i_calculateFullPath(stateFilePathFull, stateFilePathFull); 8857 8857 if (RT_FAILURE(vrc)) 8858 return setError (E_FAIL,8859 tr("Invalid saved state file path '%s' (%Rrc)"),8860 config.strStateFile.c_str(),8861 vrc);8858 return setErrorBoth(E_FAIL, vrc, 8859 tr("Invalid saved state file path '%s' (%Rrc)"), 8860 config.strStateFile.c_str(), 8861 vrc); 8862 8862 mSSData->strStateFilePath = stateFilePathFull; 8863 8863 } … … 8966 8966 int vrc = i_calculateFullPath(strStateFile, strStateFile); 8967 8967 if (RT_FAILURE(vrc)) 8968 return setError (E_FAIL,8969 tr("Invalid saved state file path '%s' (%Rrc)"),8970 strStateFile.c_str(),8971 vrc);8968 return setErrorBoth(E_FAIL, vrc, 8969 tr("Invalid saved state file path '%s' (%Rrc)"), 8970 strStateFile.c_str(), 8971 vrc); 8972 8972 } 8973 8973 … … 9951 9951 if (RT_FAILURE(vrc)) 9952 9952 { 9953 rc = setError (E_FAIL,9954 tr("Could not rename the directory '%s' to '%s' to save the settings file (%Rrc)"),9955 configDir.c_str(),9956 newConfigDir.c_str(),9957 vrc);9953 rc = setErrorBoth(E_FAIL, vrc, 9954 tr("Could not rename the directory '%s' to '%s' to save the settings file (%Rrc)"), 9955 configDir.c_str(), 9956 newConfigDir.c_str(), 9957 vrc); 9958 9958 break; 9959 9959 } … … 9989 9989 if (RT_FAILURE(vrc)) 9990 9990 { 9991 rc = setError (E_FAIL,9992 tr("Could not rename the settings file '%s' to '%s' (%Rrc)"),9993 configFile.c_str(),9994 newConfigFile.c_str(),9995 vrc);9991 rc = setErrorBoth(E_FAIL, vrc, 9992 tr("Could not rename the settings file '%s' to '%s' (%Rrc)"), 9993 configFile.c_str(), 9994 newConfigFile.c_str(), 9995 vrc); 9996 9996 break; 9997 9997 } … … 10063 10063 if (RT_FAILURE(vrc)) 10064 10064 { 10065 return setError (E_FAIL,10066 tr("Could not create a directory '%s' to save the settings file (%Rrc)"),10067 path.c_str(),10068 vrc);10065 return setErrorBoth(E_FAIL, vrc, 10066 tr("Could not create a directory '%s' to save the settings file (%Rrc)"), 10067 path.c_str(), 10068 vrc); 10069 10069 } 10070 10070 } … … 10076 10076 RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE); 10077 10077 if (RT_FAILURE(vrc)) 10078 return setError (E_FAIL,10079 tr("Could not create the settings file '%s' (%Rrc)"),10080 path.c_str(),10081 vrc);10078 return setErrorBoth(E_FAIL, vrc, 10079 tr("Could not create the settings file '%s' (%Rrc)"), 10080 path.c_str(), 10081 vrc); 10082 10082 RTFileClose(f); 10083 10083 } … … 13274 13274 int vrc = i_calculateFullPath(aSavedStateFile, stateFilePathFull); 13275 13275 if (RT_FAILURE(vrc)) 13276 return setError (VBOX_E_FILE_ERROR,13277 tr("Invalid saved state file path '%s' (%Rrc)"),13278 aSavedStateFile.c_str(),13279 vrc);13276 return setErrorBoth(VBOX_E_FILE_ERROR, vrc, 13277 tr("Invalid saved state file path '%s' (%Rrc)"), 13278 aSavedStateFile.c_str(), 13279 vrc); 13280 13280 13281 13281 mSSData->strStateFilePath = stateFilePathFull; … … 13927 13927 Utf8Str filename = authLibrary; 13928 13928 13929 int rc = AuthLibLoad(&mAuthLibCtx, filename.c_str()); 13930 if (RT_FAILURE(rc)) 13931 { 13932 hr = setError(E_FAIL, 13933 tr("Could not load the external authentication library '%s' (%Rrc)"), 13934 filename.c_str(), rc); 13935 } 13929 int vrc = AuthLibLoad(&mAuthLibCtx, filename.c_str()); 13930 if (RT_FAILURE(vrc)) 13931 hr = setErrorBoth(E_FAIL, vrc, 13932 tr("Could not load the external authentication library '%s' (%Rrc)"), 13933 filename.c_str(), vrc); 13936 13934 } 13937 13935 -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r72973 r73003 221 221 int vrc = RTFileQuerySize(sst.strSaveStateFile.c_str(), &cbSize); 222 222 if (RT_FAILURE(vrc)) 223 return p->setError (VBOX_E_IPRT_ERROR, p->tr("Could not query file size of '%s' (%Rrc)"),224 sst.strSaveStateFile.c_str(), vrc);225 /* same rule as above: count both the data which needs to223 return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, p->tr("Could not query file size of '%s' (%Rrc)"), 224 sst.strSaveStateFile.c_str(), vrc); 225 /* same rule as above: count both the data which needs to 226 226 * be read and written */ 227 227 sst.uWeight = (ULONG)(2 * (cbSize + _1M - 1) / _1M); … … 965 965 966 966 if (RT_FAILURE(vrc)) 967 p->setError (VBOX_E_IPRT_ERROR, "Could not create machine clone thread (%Rrc)", vrc);967 p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, "Could not create machine clone thread (%Rrc)", vrc); 968 968 } 969 969 catch (HRESULT rc2) … … 1393 1393 int vrc = RTDirCreateFullPath(strTrgSnapshotFolder.c_str(), 0700); 1394 1394 if (RT_FAILURE(vrc)) 1395 throw p->setError (VBOX_E_IPRT_ERROR,1396 p->tr("Could not create snapshots folder '%s' (%Rrc)"),1397 strTrgSnapshotFolder.c_str(), vrc);1395 throw p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1396 p->tr("Could not create snapshots folder '%s' (%Rrc)"), 1397 strTrgSnapshotFolder.c_str(), vrc); 1398 1398 } 1399 1399 /* Clone all save state files. */ … … 1414 1414 MachineCloneVMPrivate::copyStateFileProgress, &d->pProgress); 1415 1415 if (RT_FAILURE(vrc)) 1416 throw p->setError (VBOX_E_IPRT_ERROR,1417 p->tr("Could not copy state file '%s' to '%s' (%Rrc)"),1418 1416 throw p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1417 p->tr("Could not copy state file '%s' to '%s' (%Rrc)"), 1418 sst.strSaveStateFile.c_str(), strTrgSaveState.c_str(), vrc); 1419 1419 newFiles.append(strTrgSaveState); 1420 1420 } … … 1507 1507 vrc = RTFileDelete(newFiles.at(i).c_str()); 1508 1508 if (RT_FAILURE(vrc)) 1509 mrc = p->setError(VBOX_E_IPRT_ERROR, p->tr("Could not delete file '%s' (%Rrc)"), newFiles.at(i).c_str(), vrc); 1509 mrc = p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1510 p->tr("Could not delete file '%s' (%Rrc)"), newFiles.at(i).c_str(), vrc); 1510 1511 } 1511 1512 /* Delete all already created medias. (Reverse, cause there could be -
trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp
r72841 r73003 185 185 strTargetFolder.c_str()); 186 186 errorsList.push_back(ErrorInfoItem(E_FAIL, errorDesc.c_str())); 187 rc = m_pMachine->setError (E_FAIL, m_pMachine->tr(errorDesc.c_str()));187 rc = m_pMachine->setErrorBoth(E_FAIL, vrc, m_pMachine->tr(errorDesc.c_str())); 188 188 throw rc; 189 189 } … … 204 204 "the destination folder.", strTargetFolder.c_str()); 205 205 errorsList.push_back(ErrorInfoItem(HRESULT(vrc), errorDesc.c_str())); 206 rc = m_pMachine->setError(vrc, m_pMachine->tr(errorDesc.c_str())); 207 206 rc = m_pMachine->setErrorBoth(VBOX_E_FILE_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 208 207 } 209 208 … … 493 492 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 494 493 495 throw m_pMachine->setError(VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str()));494 throw m_pMachine->setError(VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str())); 496 495 } 497 496 } … … 658 657 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 659 658 660 throw machine->setError (VBOX_E_IPRT_ERROR,machine->tr(errorDesc.c_str()));659 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 661 660 } 662 661 } … … 682 681 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 683 682 684 throw machine->setError (VBOX_E_IPRT_ERROR,machine->tr(errorDesc.c_str()));683 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 685 684 } 686 685 … … 731 730 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 732 731 733 throw machine->setError (VBOX_E_IPRT_ERROR,machine->tr(errorDesc.c_str()));732 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 734 733 } 735 734 LogRelFunc(("Created a home machine folder %s\n", strTargetSettingsFilePath.c_str())); … … 755 754 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 756 755 757 throw machine->setError (VBOX_E_IPRT_ERROR, machine->tr(errorDesc.c_str()));756 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 758 757 } 759 758 … … 789 788 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 790 789 791 throw machine->setError (VBOX_E_IPRT_ERROR,machine->tr(errorDesc.c_str()));790 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 792 791 } 793 792 LogRelFunc(("Created a log machine folder %s\n", strTargetLogFolderPath.c_str())); … … 807 806 /* Move to next sub-operation. */ 808 807 rc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(machine->tr("Copying the log file '%s' ..."), 809 RTPathFilename(strFullSourceFilePath.c_str())).raw(), 1); 808 RTPathFilename(strFullSourceFilePath.c_str())).raw(), 809 1); 810 810 if (FAILED(rc)) throw rc; 811 811 812 812 int vrc = RTFileCopyEx(strFullSourceFilePath.c_str(), strFullTargetFilePath.c_str(), 0, 813 MachineMoveVM::copyFileProgress, &taskMoveVM->m_pProgress);813 MachineMoveVM::copyFileProgress, &taskMoveVM->m_pProgress); 814 814 if (RT_FAILURE(vrc)) 815 815 { … … 820 820 taskMoveVM->errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 821 821 822 throw machine->setError (VBOX_E_IPRT_ERROR,machine->tr(errorDesc.c_str()));822 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, machine->tr(errorDesc.c_str())); 823 823 } 824 824 825 825 LogRelFunc(("The log file %s has been copied into the folder %s\n", strFullSourceFilePath.c_str(), 826 826 strFullTargetFilePath.stripFilename().c_str())); 827 827 828 828 /* save new file in case of restoring */ … … 1232 1232 1233 1233 vrc = RTDirClose(hDir); 1234 AssertRC(vrc); 1234 1235 } 1235 1236 else if (vrc == VERR_FILE_NOT_FOUND) … … 1238 1239 errorsList.push_back(ErrorInfoItem(VERR_FILE_NOT_FOUND, errorDesc.c_str())); 1239 1240 1240 m_pMachine->setError(VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str())); 1241 rc = vrc; 1241 rc = m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 1242 1242 } 1243 1243 else … … 1246 1246 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 1247 1247 1248 throw m_pMachine->setError(VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str())); 1248 /** @todo r=bird: document this throwing business, please! Error handling is 1249 * a bit fishy here. See also */ 1250 throw m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 1249 1251 } 1250 1252 … … 1270 1272 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 1271 1273 1272 rc = m_pMachine->setError (VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str()));1274 rc = m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 1273 1275 } 1274 1276 else … … 1317 1319 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 1318 1320 1319 throw m_pMachine->setError (VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str()));1321 throw m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 1320 1322 } 1321 1323 ++it; … … 1326 1328 else 1327 1329 { 1328 Utf8StrFmt errorDesc("Could not calculate the size of folder '%s' (%Rrc)", strRootFolder.c_str(), vrc); 1330 /** @todo r=bird: This only happens if RTDirOpen fails. So, I'm not sure 1331 * what you're going for here... See not about throwing in getFilesList(). */ 1332 Utf8StrFmt errorDesc("Could not calculate the size of folder '%s'", strRootFolder.c_str()); 1329 1333 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 1330 1334 … … 1502 1506 errorsList.push_back(ErrorInfoItem(VBOX_E_IPRT_ERROR, errorDesc.c_str())); 1503 1507 1504 return m_pMachine->setError (VBOX_E_IPRT_ERROR, m_pMachine->tr(errorDesc.c_str()));1508 return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, m_pMachine->tr(errorDesc.c_str())); 1505 1509 } 1506 1510 /* same rule as above: count both the data which needs to -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r72999 r73003 3610 3610 int vrc = VDPluginLoadFromFilename(strPlugin.c_str()); 3611 3611 if (RT_FAILURE(vrc)) 3612 throw setError (VBOX_E_NOT_SUPPORTED,3613 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"),3614 i_vdError(vrc).c_str());3612 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 3613 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"), 3614 i_vdError(vrc).c_str()); 3615 3615 } 3616 3616 else … … 3633 3633 vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_READ | VD_FILTER_FLAGS_INFO, CryptoSettings.vdFilterIfaces); 3634 3634 if (RT_FAILURE(vrc)) 3635 throw setError (VBOX_E_INVALID_OBJECT_STATE,3636 tr("Failed to load the encryption filter: %s"),3637 i_vdError(vrc).c_str());3635 throw setErrorBoth(VBOX_E_INVALID_OBJECT_STATE, vrc, 3636 tr("Failed to load the encryption filter: %s"), 3637 i_vdError(vrc).c_str()); 3638 3638 3639 3639 it = pBase->m->mapProperties.find("CRYPT/KeyId"); … … 3686 3686 int vrc = VDPluginLoadFromFilename(strPlugin.c_str()); 3687 3687 if (RT_FAILURE(vrc)) 3688 throw setError (VBOX_E_NOT_SUPPORTED,3689 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"),3690 i_vdError(vrc).c_str());3688 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 3689 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"), 3690 i_vdError(vrc).c_str()); 3691 3691 } 3692 3692 else … … 3713 3713 tr("The given password is incorrect")); 3714 3714 else if (RT_FAILURE(vrc)) 3715 throw setError (VBOX_E_INVALID_OBJECT_STATE,3716 tr("Failed to load the encryption filter: %s"),3717 i_vdError(vrc).c_str());3715 throw setErrorBoth(VBOX_E_INVALID_OBJECT_STATE, vrc, 3716 tr("Failed to load the encryption filter: %s"), 3717 i_vdError(vrc).c_str()); 3718 3718 3719 3719 VDDestroy(pDisk); … … 6085 6085 catch (int aVRC) 6086 6086 { 6087 rc = setError (E_FAIL,6088 tr("Could not update medium UUID references to parent '%s' (%s)"),6089 m->strLocationFull.c_str(),6090 i_vdError(aVRC).c_str());6087 rc = setErrorBoth(E_FAIL, aVRC, 6088 tr("Could not update medium UUID references to parent '%s' (%s)"), 6089 m->strLocationFull.c_str(), 6090 i_vdError(aVRC).c_str()); 6091 6091 } 6092 6092 … … 7425 7425 { 7426 7426 if (vrc == VERR_ACCESS_DENIED) 7427 return setError (VBOX_E_FILE_ERROR,7428 tr("Permission problem accessing the file for the medium '%s' (%Rrc)"),7429 locationFull.c_str(), vrc);7427 return setErrorBoth(VBOX_E_FILE_ERROR, vrc, 7428 tr("Permission problem accessing the file for the medium '%s' (%Rrc)"), 7429 locationFull.c_str(), vrc); 7430 7430 else if (vrc == VERR_FILE_NOT_FOUND || vrc == VERR_PATH_NOT_FOUND) 7431 return setError (VBOX_E_FILE_ERROR,7432 tr("Could not find file for the medium '%s' (%Rrc)"),7433 locationFull.c_str(), vrc);7431 return setErrorBoth(VBOX_E_FILE_ERROR, vrc, 7432 tr("Could not find file for the medium '%s' (%Rrc)"), 7433 locationFull.c_str(), vrc); 7434 7434 else if (aFormat.isEmpty()) 7435 return setError (VBOX_E_IPRT_ERROR,7436 tr("Could not get the storage format of the medium '%s' (%Rrc)"),7437 locationFull.c_str(), vrc);7435 return setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 7436 tr("Could not get the storage format of the medium '%s' (%Rrc)"), 7437 locationFull.c_str(), vrc); 7438 7438 else 7439 7439 { … … 8046 8046 vrc = VDPluginLoadFromFilename(strPlugin.c_str()); 8047 8047 if (RT_FAILURE(vrc)) 8048 throw setError (VBOX_E_NOT_SUPPORTED,8049 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"),8050 i_vdError(vrc).c_str());8048 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 8049 tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"), 8050 i_vdError(vrc).c_str()); 8051 8051 } 8052 8052 else … … 8087 8087 pKeyStore->releaseSecretKey(itKeyId->second); 8088 8088 if (vrc == VERR_VD_PASSWORD_INCORRECT) 8089 throw setError (VBOX_E_PASSWORD_INCORRECT, tr("The password to decrypt the image is incorrect"));8089 throw setErrorBoth(VBOX_E_PASSWORD_INCORRECT, vrc, tr("The password to decrypt the image is incorrect")); 8090 8090 if (RT_FAILURE(vrc)) 8091 throw setError (VBOX_E_INVALID_OBJECT_STATE, tr("Failed to load the decryption filter: %s"),8092 i_vdError(vrc).c_str());8091 throw setErrorBoth(VBOX_E_INVALID_OBJECT_STATE, vrc, tr("Failed to load the decryption filter: %s"), 8092 i_vdError(vrc).c_str()); 8093 8093 } 8094 8094 … … 8117 8117 pMedium->m->vdImageIfaces); 8118 8118 if (RT_FAILURE(vrc)) 8119 throw setError (VBOX_E_FILE_ERROR,8120 tr("Could not open the medium storage unit '%s'%s"),8121 pMedium->m->strLocationFull.c_str(),8122 i_vdError(vrc).c_str());8119 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 8120 tr("Could not open the medium storage unit '%s'%s"), 8121 pMedium->m->strLocationFull.c_str(), 8122 i_vdError(vrc).c_str()); 8123 8123 } 8124 8124 … … 8405 8405 pMedium->m->vdImageIfaces); 8406 8406 if (RT_FAILURE(vrc)) 8407 throw setError (VBOX_E_FILE_ERROR,8408 tr("Could not open the medium storage unit '%s'%s"),8409 pMedium->m->strLocationFull.c_str(),8410 i_vdError(vrc).c_str());8407 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 8408 tr("Could not open the medium storage unit '%s'%s"), 8409 pMedium->m->strLocationFull.c_str(), 8410 i_vdError(vrc).c_str()); 8411 8411 } 8412 8412 … … 8434 8434 { 8435 8435 if (vrc == VERR_VD_INVALID_TYPE) 8436 throw setError (VBOX_E_FILE_ERROR,8437 tr("Parameters for creating the differencing medium storage unit '%s' are invalid%s"),8438 targetLocation.c_str(), i_vdError(vrc).c_str());8436 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 8437 tr("Parameters for creating the differencing medium storage unit '%s' are invalid%s"), 8438 targetLocation.c_str(), i_vdError(vrc).c_str()); 8439 8439 else 8440 throw setError (VBOX_E_FILE_ERROR,8441 tr("Could not create the differencing medium storage unit '%s'%s"),8442 targetLocation.c_str(), i_vdError(vrc).c_str());8440 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 8441 tr("Could not create the differencing medium storage unit '%s'%s"), 8442 targetLocation.c_str(), i_vdError(vrc).c_str()); 8443 8443 } 8444 8444 … … 8687 8687 catch (int aVRC) 8688 8688 { 8689 rcTmp = setError (VBOX_E_FILE_ERROR,8690 tr("Could not merge the medium '%s' to '%s'%s"),8691 m->strLocationFull.c_str(),8692 pTarget->m->strLocationFull.c_str(),8693 i_vdError(aVRC).c_str());8689 rcTmp = setErrorBoth(VBOX_E_FILE_ERROR, aVRC, 8690 tr("Could not merge the medium '%s' to '%s'%s"), 8691 m->strLocationFull.c_str(), 8692 pTarget->m->strLocationFull.c_str(), 8693 i_vdError(aVRC).c_str()); 8694 8694 } 8695 8695 … … 8934 8934 pMedium->m->vdImageIfaces); 8935 8935 if (RT_FAILURE(vrc)) 8936 throw setError (VBOX_E_FILE_ERROR,8937 tr("Could not open the medium storage unit '%s'%s"),8938 pMedium->m->strLocationFull.c_str(),8939 i_vdError(vrc).c_str());8936 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 8937 tr("Could not open the medium storage unit '%s'%s"), 8938 pMedium->m->strLocationFull.c_str(), 8939 i_vdError(vrc).c_str()); 8940 8940 } 8941 8941 … … 9004 9004 pMedium->m->vdImageIfaces); 9005 9005 if (RT_FAILURE(vrc)) 9006 throw setError (VBOX_E_FILE_ERROR,9007 tr("Could not open the medium storage unit '%s'%s"),9008 pMedium->m->strLocationFull.c_str(),9009 i_vdError(vrc).c_str());9006 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9007 tr("Could not open the medium storage unit '%s'%s"), 9008 pMedium->m->strLocationFull.c_str(), 9009 i_vdError(vrc).c_str()); 9010 9010 } 9011 9011 … … 9046 9046 } 9047 9047 if (RT_FAILURE(vrc)) 9048 throw setError (VBOX_E_FILE_ERROR,9049 tr("Could not create the clone medium '%s'%s"),9050 targetLocation.c_str(), i_vdError(vrc).c_str());9048 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9049 tr("Could not create the clone medium '%s'%s"), 9050 targetLocation.c_str(), i_vdError(vrc).c_str()); 9051 9051 9052 9052 size = VDGetFileSize(targetHdd, VD_LAST_IMAGE); … … 9245 9245 pMedium->m->vdImageIfaces); 9246 9246 if (RT_FAILURE(vrc)) 9247 throw setError (VBOX_E_FILE_ERROR,9248 tr("Could not open the medium storage unit '%s'%s"),9249 pMedium->m->strLocationFull.c_str(),9250 i_vdError(vrc).c_str());9247 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9248 tr("Could not open the medium storage unit '%s'%s"), 9249 pMedium->m->strLocationFull.c_str(), 9250 i_vdError(vrc).c_str()); 9251 9251 } 9252 9252 … … 9291 9291 NULL); 9292 9292 if (RT_FAILURE(vrc)) 9293 throw setError (VBOX_E_FILE_ERROR,9294 tr("Could not move medium '%s'%s"),9295 targetLocation.c_str(), i_vdError(vrc).c_str());9293 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9294 tr("Could not move medium '%s'%s"), 9295 targetLocation.c_str(), i_vdError(vrc).c_str()); 9296 9296 size = VDGetFileSize(hdd, VD_LAST_IMAGE); 9297 9297 logicalSize = VDGetSize(hdd, VD_LAST_IMAGE); … … 9383 9383 9384 9384 if (RT_FAILURE(vrc) && vrc != VERR_FILE_NOT_FOUND) 9385 throw setError (VBOX_E_FILE_ERROR,9386 tr("Could not delete the medium storage unit '%s'%s"),9387 location.c_str(), i_vdError(vrc).c_str());9385 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9386 tr("Could not delete the medium storage unit '%s'%s"), 9387 location.c_str(), i_vdError(vrc).c_str()); 9388 9388 9389 9389 } … … 9478 9478 pMedium->m->vdImageIfaces); 9479 9479 if (RT_FAILURE(vrc)) 9480 throw setError (VBOX_E_FILE_ERROR,9481 tr("Could not open the medium storage unit '%s'%s"),9482 pMedium->m->strLocationFull.c_str(),9483 i_vdError(vrc).c_str());9480 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9481 tr("Could not open the medium storage unit '%s'%s"), 9482 pMedium->m->strLocationFull.c_str(), 9483 i_vdError(vrc).c_str()); 9484 9484 9485 9485 /* Done when we hit the media which should be reset */ … … 9491 9491 vrc = VDClose(hdd, true /* fDelete */); 9492 9492 if (RT_FAILURE(vrc)) 9493 throw setError (VBOX_E_FILE_ERROR,9494 tr("Could not delete the medium storage unit '%s'%s"),9495 location.c_str(), i_vdError(vrc).c_str());9493 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9494 tr("Could not delete the medium storage unit '%s'%s"), 9495 location.c_str(), i_vdError(vrc).c_str()); 9496 9496 9497 9497 /* next, create it again */ … … 9502 9502 m->vdImageIfaces); 9503 9503 if (RT_FAILURE(vrc)) 9504 throw setError (VBOX_E_FILE_ERROR,9505 tr("Could not open the medium storage unit '%s'%s"),9506 parentLocation.c_str(), i_vdError(vrc).c_str());9504 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9505 tr("Could not open the medium storage unit '%s'%s"), 9506 parentLocation.c_str(), i_vdError(vrc).c_str()); 9507 9507 9508 9508 vrc = VDCreateDiff(hdd, … … 9520 9520 { 9521 9521 if (vrc == VERR_VD_INVALID_TYPE) 9522 throw setError (VBOX_E_FILE_ERROR,9523 tr("Parameters for creating the differencing medium storage unit '%s' are invalid%s"),9524 location.c_str(), i_vdError(vrc).c_str());9522 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9523 tr("Parameters for creating the differencing medium storage unit '%s' are invalid%s"), 9524 location.c_str(), i_vdError(vrc).c_str()); 9525 9525 else 9526 throw setError (VBOX_E_FILE_ERROR,9527 tr("Could not create the differencing medium storage unit '%s'%s"),9528 location.c_str(), i_vdError(vrc).c_str());9526 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9527 tr("Could not create the differencing medium storage unit '%s'%s"), 9528 location.c_str(), i_vdError(vrc).c_str()); 9529 9529 } 9530 9530 … … 9608 9608 pMedium->m->vdImageIfaces); 9609 9609 if (RT_FAILURE(vrc)) 9610 throw setError (VBOX_E_FILE_ERROR,9611 tr("Could not open the medium storage unit '%s'%s"),9612 pMedium->m->strLocationFull.c_str(),9613 i_vdError(vrc).c_str());9610 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9611 tr("Could not open the medium storage unit '%s'%s"), 9612 pMedium->m->strLocationFull.c_str(), 9613 i_vdError(vrc).c_str()); 9614 9614 } 9615 9615 … … 9625 9625 { 9626 9626 if (vrc == VERR_NOT_SUPPORTED) 9627 throw setError (VBOX_E_NOT_SUPPORTED,9628 tr("Compacting is not yet supported for medium '%s'"),9629 location.c_str());9627 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 9628 tr("Compacting is not yet supported for medium '%s'"), 9629 location.c_str()); 9630 9630 else if (vrc == VERR_NOT_IMPLEMENTED) 9631 throw setError (E_NOTIMPL,9632 tr("Compacting is not implemented, medium '%s'"),9633 location.c_str());9631 throw setErrorBoth(E_NOTIMPL, vrc, 9632 tr("Compacting is not implemented, medium '%s'"), 9633 location.c_str()); 9634 9634 else 9635 throw setError (VBOX_E_FILE_ERROR,9636 tr("Could not compact medium '%s'%s"),9637 location.c_str(),9638 i_vdError(vrc).c_str());9635 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9636 tr("Could not compact medium '%s'%s"), 9637 location.c_str(), 9638 i_vdError(vrc).c_str()); 9639 9639 } 9640 9640 } … … 9706 9706 pMedium->m->vdImageIfaces); 9707 9707 if (RT_FAILURE(vrc)) 9708 throw setError (VBOX_E_FILE_ERROR,9709 tr("Could not open the medium storage unit '%s'%s"),9710 pMedium->m->strLocationFull.c_str(),9711 i_vdError(vrc).c_str());9708 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9709 tr("Could not open the medium storage unit '%s'%s"), 9710 pMedium->m->strLocationFull.c_str(), 9711 i_vdError(vrc).c_str()); 9712 9712 } 9713 9713 … … 9724 9724 { 9725 9725 if (vrc == VERR_NOT_SUPPORTED) 9726 throw setError (VBOX_E_NOT_SUPPORTED,9727 tr("Resizing to new size %llu is not yet supported for medium '%s'"),9728 task.mSize, location.c_str());9726 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 9727 tr("Resizing to new size %llu is not yet supported for medium '%s'"), 9728 task.mSize, location.c_str()); 9729 9729 else if (vrc == VERR_NOT_IMPLEMENTED) 9730 throw setError (E_NOTIMPL,9731 tr("Resiting is not implemented, medium '%s'"),9732 location.c_str());9730 throw setErrorBoth(E_NOTIMPL, vrc, 9731 tr("Resiting is not implemented, medium '%s'"), 9732 location.c_str()); 9733 9733 else 9734 throw setError (VBOX_E_FILE_ERROR,9735 tr("Could not resize medium '%s'%s"),9736 location.c_str(),9737 i_vdError(vrc).c_str());9734 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9735 tr("Could not resize medium '%s'%s"), 9736 location.c_str(), 9737 i_vdError(vrc).c_str()); 9738 9738 } 9739 9739 size = VDGetFileSize(hdd, VD_LAST_IMAGE); … … 9828 9828 task.mVDImageIfaces); 9829 9829 if (RT_FAILURE(vrc)) 9830 throw setError (VBOX_E_FILE_ERROR,9831 tr("Could not open the medium storage unit '%s'%s"),9832 task.mFilename.c_str(),9833 i_vdError(vrc).c_str());9830 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9831 tr("Could not open the medium storage unit '%s'%s"), 9832 task.mFilename.c_str(), 9833 i_vdError(vrc).c_str()); 9834 9834 9835 9835 Utf8Str targetFormat(m->strFormat); … … 9896 9896 pMedium->m->vdImageIfaces); 9897 9897 if (RT_FAILURE(vrc)) 9898 throw setError (VBOX_E_FILE_ERROR,9899 tr("Could not open the medium storage unit '%s'%s"),9900 pMedium->m->strLocationFull.c_str(),9901 i_vdError(vrc).c_str());9898 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9899 tr("Could not open the medium storage unit '%s'%s"), 9900 pMedium->m->strLocationFull.c_str(), 9901 i_vdError(vrc).c_str()); 9902 9902 } 9903 9903 … … 9916 9916 task.mVDOperationIfaces); 9917 9917 if (RT_FAILURE(vrc)) 9918 throw setError (VBOX_E_FILE_ERROR,9919 tr("Could not create the imported medium '%s'%s"),9920 targetLocation.c_str(), i_vdError(vrc).c_str());9918 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 9919 tr("Could not create the imported medium '%s'%s"), 9920 targetLocation.c_str(), i_vdError(vrc).c_str()); 9921 9921 9922 9922 size = VDGetFileSize(targetHdd, VD_LAST_IMAGE); … … 10094 10094 int vrc = VDPluginLoadFromFilename(strPlugin.c_str()); 10095 10095 if (RT_FAILURE(vrc)) 10096 throw setError (VBOX_E_NOT_SUPPORTED,10097 tr("Encrypting the image failed because the encryption plugin could not be loaded (%s)"),10098 i_vdError(vrc).c_str());10096 throw setErrorBoth(VBOX_E_NOT_SUPPORTED, vrc, 10097 tr("Encrypting the image failed because the encryption plugin could not be loaded (%s)"), 10098 i_vdError(vrc).c_str()); 10099 10099 } 10100 10100 else … … 10172 10172 vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_WRITE, CryptoSettingsWrite.vdFilterIfaces); 10173 10173 if (RT_FAILURE(vrc)) 10174 throw setError (VBOX_E_INVALID_OBJECT_STATE,10175 tr("Failed to load the encryption filter: %s"),10176 i_vdError(vrc).c_str());10174 throw setErrorBoth(VBOX_E_INVALID_OBJECT_STATE, vrc, 10175 tr("Failed to load the encryption filter: %s"), 10176 i_vdError(vrc).c_str()); 10177 10177 } 10178 10178 else if (task.mstrNewPasswordId.isNotEmpty() || task.mstrNewPassword.isNotEmpty()) … … 10207 10207 pMedium->m->vdImageIfaces); 10208 10208 if (RT_FAILURE(vrc)) 10209 throw setError (VBOX_E_FILE_ERROR,10210 tr("Could not open the medium storage unit '%s'%s"),10211 pMedium->m->strLocationFull.c_str(),10212 i_vdError(vrc).c_str());10209 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 10210 tr("Could not open the medium storage unit '%s'%s"), 10211 pMedium->m->strLocationFull.c_str(), 10212 i_vdError(vrc).c_str()); 10213 10213 } 10214 10214 … … 10222 10222 vrc = VDPrepareWithFilters(pDisk, task.mVDOperationIfaces); 10223 10223 if (RT_FAILURE(vrc)) 10224 throw setError (VBOX_E_FILE_ERROR,10225 tr("Could not prepare disk images for encryption (%Rrc): %s"),10226 vrc, i_vdError(vrc).c_str());10224 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, 10225 tr("Could not prepare disk images for encryption (%Rrc): %s"), 10226 vrc, i_vdError(vrc).c_str()); 10227 10227 10228 10228 thisLock.acquire(); -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r69500 r73003 1171 1171 int vrc = RTPathUserHome(szHome, sizeof(szHome)); 1172 1172 if (RT_FAILURE(vrc)) 1173 return setError (E_FAIL,1174 tr("Cannot determine user home directory (%Rrc)"),1175 vrc);1173 return setErrorBoth(E_FAIL, vrc, 1174 tr("Cannot determine user home directory (%Rrc)"), 1175 vrc); 1176 1176 strPath = szHome; 1177 1177 return S_OK; … … 1287 1287 m->strAutostartDatabasePath = aPath; 1288 1288 else 1289 rc = setError (E_FAIL,1290 tr("Cannot set the autostart database path (%Rrc)"),1291 vrc);1289 rc = setErrorBoth(E_FAIL, vrc, 1290 tr("Cannot set the autostart database path (%Rrc)"), 1291 vrc); 1292 1292 } 1293 1293 else … … 1297 1297 m->strAutostartDatabasePath = ""; 1298 1298 else 1299 rc = setError (E_FAIL,1300 tr("Deleting the autostart database path failed (%Rrc)"),1301 vrc);1299 rc = setErrorBoth(E_FAIL, vrc, 1300 tr("Deleting the autostart database path failed (%Rrc)"), 1301 vrc); 1302 1302 } 1303 1303 -
trunk/src/VBox/Main/src-server/USBProxyService.cpp
r72833 r73003 949 949 va_start(va, aText); 950 950 HRESULT rc = VirtualBoxBase::setErrorInternal(aResultCode, 951 952 953 954 955 951 COM_IIDOF(IHost), 952 "USBProxyService", 953 Utf8Str(aText, va), 954 false /* aWarning*/, 955 true /* aLogIt*/); 956 956 va_end(va); 957 957 return rc; -
trunk/src/VBox/Main/src-server/VFSExplorerImpl.cpp
r69753 r73003 319 319 } 320 320 else 321 rc = setError (VBOX_E_FILE_ERROR, tr ("Can't open directory '%s' (%Rrc)"), m->strPath.c_str(), vrc);321 rc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr ("Can't open directory '%s' (%Rrc)"), m->strPath.c_str(), vrc); 322 322 323 323 if (aTask->m_ptrProgress) … … 362 362 int vrc = RTPathJoin(szPath, sizeof(szPath), m->strPath.c_str(), (*it).c_str()); 363 363 if (RT_FAILURE(vrc)) 364 throw setError (E_FAIL, tr("Internal Error (%Rrc)"), vrc);364 throw setErrorBoth(E_FAIL, vrc, tr("Internal Error (%Rrc)"), vrc); 365 365 vrc = RTFileDelete(szPath); 366 366 if (RT_FAILURE(vrc)) 367 throw setError (VBOX_E_FILE_ERROR, tr("Can't delete file '%s' (%Rrc)"), szPath, vrc);367 throw setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Can't delete file '%s' (%Rrc)"), szPath, vrc); 368 368 if (aTask->m_ptrProgress) 369 369 aTask->m_ptrProgress->SetCurrentOperationProgress((ULONG)(fPercentStep * (float)i)); -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r72919 r73003 401 401 int vrc = com::GetVBoxUserHomeDirectory(szHomeDir, sizeof(szHomeDir)); 402 402 if (RT_FAILURE(vrc)) 403 throw setError (E_FAIL,404 tr("Could not create the VirtualBox home directory '%s' (%Rrc)"),405 szHomeDir, vrc);403 throw setErrorBoth(E_FAIL, vrc, 404 tr("Could not create the VirtualBox home directory '%s' (%Rrc)"), 405 szHomeDir, vrc); 406 406 407 407 unconst(m->strHomeDir) = szHomeDir; … … 2628 2628 if (RT_FAILURE(vrc)) 2629 2629 { 2630 rc = pTask->that->setError (E_FAIL, tr("Could not create the communication channel (%Rrc)"), vrc);2630 rc = pTask->that->setErrorBoth(E_FAIL, vrc, tr("Could not create the communication channel (%Rrc)"), vrc); 2631 2631 break; 2632 2632 } … … 2673 2673 * (pressing the Cancel button to close the Run As dialog) */ 2674 2674 if (vrc2 == VERR_CANCELLED) 2675 rc = pTask->that->setError (E_FAIL, tr("Operation canceled by the user"));2675 rc = pTask->that->setErrorBoth(E_FAIL, vrc, tr("Operation canceled by the user")); 2676 2676 else 2677 rc = pTask->that->setError (E_FAIL, tr("Could not launch a privileged process '%s' (%Rrc)"), exePath, vrc2);2677 rc = pTask->that->setErrorBoth(E_FAIL, vrc, tr("Could not launch a privileged process '%s' (%Rrc)"), exePath, vrc2); 2678 2678 break; 2679 2679 } … … 2685 2685 if (RT_FAILURE(vrc)) 2686 2686 { 2687 rc = pTask->that->setError (E_FAIL, tr("Could not launch a process '%s' (%Rrc)"), exePath, vrc);2687 rc = pTask->that->setErrorBoth(E_FAIL, vrc, tr("Could not launch a process '%s' (%Rrc)"), exePath, vrc); 2688 2688 break; 2689 2689 } … … 2708 2708 if (SUCCEEDED(rc) && RT_FAILURE(vrc)) 2709 2709 { 2710 rc = pTask->that->setError (E_FAIL, tr("Could not operate the communication channel (%Rrc)"), vrc);2710 rc = pTask->that->setErrorBoth(E_FAIL, vrc, tr("Could not operate the communication channel (%Rrc)"), vrc); 2711 2711 break; 2712 2712 } … … 4856 4856 int vrc = RTDirCreateFullPath(strDir.c_str(), 0700); 4857 4857 if (RT_FAILURE(vrc)) 4858 return i_setErrorStatic (VBOX_E_IPRT_ERROR,4859 Utf8StrFmt(tr("Could not create the directory '%s' (%Rrc)"),4860 strDir.c_str(),4861 vrc));4858 return i_setErrorStaticBoth(VBOX_E_IPRT_ERROR, vrc, 4859 Utf8StrFmt(tr("Could not create the directory '%s' (%Rrc)"), 4860 strDir.c_str(), 4861 vrc)); 4862 4862 } 4863 4863 else 4864 return i_setErrorStatic(VBOX_E_IPRT_ERROR, 4865 Utf8StrFmt(tr("Directory '%s' does not exist"), 4866 strDir.c_str())); 4864 return i_setErrorStaticBoth(VBOX_E_IPRT_ERROR, VERR_FILE_NOT_FOUND, 4865 Utf8StrFmt(tr("Directory '%s' does not exist"), strDir.c_str())); 4867 4866 } 4868 4867
Note:
See TracChangeset
for help on using the changeset viewer.