VirtualBox

Changeset 32571 in vbox


Ignore:
Timestamp:
Sep 16, 2010 4:09:05 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
65964
Message:

Main: remove that annoying DebugBreakThrow (VBoxSVC asserts even on valid errors in debug mode)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ApplianceImplImport.cpp

    r32568 r32571  
    154154            ComObjPtr<VirtualSystemDescription> pNewDesc;
    155155            rc = pNewDesc.createObject();
    156             if (FAILED(rc)) DebugBreakThrow(rc);
     156            if (FAILED(rc)) throw rc;
    157157            rc = pNewDesc->init();
    158             if (FAILED(rc)) DebugBreakThrow(rc);
     158            if (FAILED(rc)) throw rc;
    159159
    160160            // if the virtual system in OVF had a <vbox:Machine> element, have the
     
    236236            ComPtr<IGuestOSType> pGuestOSType;
    237237            rc = mVirtualBox->GetGuestOSType(Bstr(strOsTypeVBox), pGuestOSType.asOutParam());
    238             if (FAILED(rc)) DebugBreakThrow(rc);
     238            if (FAILED(rc)) throw rc;
    239239
    240240            /* CPU count */
     
    272272                ULONG memSizeVBox2;
    273273                rc = pGuestOSType->COMGETTER(RecommendedRAM)(&memSizeVBox2);
    274                 if (FAILED(rc)) DebugBreakThrow(rc);
     274                if (FAILED(rc)) throw rc;
    275275                /* VBox stores that in MByte */
    276276                ullMemSizeVBox = (uint64_t)memSizeVBox2;
     
    308308                NetworkAdapterType_T defaultAdapterVBox = NetworkAdapterType_Am79C970A;
    309309                rc = pGuestOSType->COMGETTER(AdapterType)(&defaultAdapterVBox);
    310                 if (FAILED(rc)) DebugBreakThrow(rc);
     310                if (FAILED(rc)) throw rc;
    311311
    312312                ovf::EthernetAdaptersList::const_iterator itEA;
     
    510510                        const VirtualSystemDescriptionEntry *pController;
    511511                        if (!(pController = pNewDesc->findControllerFromID(hd.idController)))
    512                             DebugBreakThrow(setError(E_FAIL,
     512                            throw setError(E_FAIL,
    513513                                           tr("Cannot find hard disk controller with OVF instance ID %RI32 to which disk \"%s\" should be attached"),
    514514                                           hd.idController,
    515                                            di.strHref.c_str()));
     515                                           di.strHref.c_str());
    516516
    517517                        /* controller to attach to, and the bus within that controller */
     
    527527                    }
    528528                    else
    529                         DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    530                                        tr("Unsupported format for virtual disk image in OVF: \"%s\"", di.strFormat.c_str())));
     529                        throw setError(VBOX_E_FILE_ERROR,
     530                                       tr("Unsupported format for virtual disk image in OVF: \"%s\"", di.strFormat.c_str()));
    531531                }
    532532            }
     
    637637                                     aLocInfo.strPath.c_str()), // CBSTR bstrFirstOperationDescription,
    638638                             4); // ULONG ulFirstOperationWeight,
    639     if (FAILED(rc)) DebugBreakThrow(rc);
     639    if (FAILED(rc)) throw rc;
    640640
    641641    /* Initialize our worker task */
     
    643643
    644644    rc = task->startThread();
    645     if (FAILED(rc)) DebugBreakThrow(rc);
     645    if (FAILED(rc)) throw rc;
    646646
    647647    /* Don't destruct on success */
     
    693693        int vrc = RTSha1DigestFromFile(locInfo.strPath.c_str(), &pszDigest, NULL, NULL);
    694694        if (RT_FAILURE(vrc))
    695             DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
     695            throw setError(VBOX_E_FILE_ERROR,
    696696                           tr("Couldn't calculate SHA1 digest for file '%s' (%Rrc)"),
    697                            RTPathFilename(locInfo.strPath.c_str()), vrc));
     697                           RTPathFilename(locInfo.strPath.c_str()), vrc);
    698698        m->strOVFSHA1Digest = pszDigest;
    699699        RTStrFree(pszDigest);
     
    822822        vrc = RTDirCreateTemp(pszTmpDir);
    823823        if (RT_FAILURE(vrc))
    824             DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    825                            tr("Cannot create temporary directory '%s'"), pszTmpDir));
     824            throw setError(VBOX_E_FILE_ERROR,
     825                           tr("Cannot create temporary directory '%s'"), pszTmpDir);
    826826
    827827        /* The temporary name of the target OVF file */
     
    831831        vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(), pTask->locInfo.strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
    832832        if (RT_FAILURE(vrc))
    833             DebugBreakThrow(setError(VBOX_E_IPRT_ERROR,
    834                            tr("Cannot create S3 service handler")));
     833            throw setError(VBOX_E_IPRT_ERROR,
     834                           tr("Cannot create S3 service handler"));
    835835        RTS3SetProgressCallback(hS3, pTask->updateProgress, &pTask);
    836836
     
    843843                throw S_OK; /* todo: !!!!!!!!!!!!! */
    844844            else if (vrc == VERR_S3_ACCESS_DENIED)
    845                 DebugBreakThrow(setError(E_ACCESSDENIED,
     845                throw setError(E_ACCESSDENIED,
    846846                               tr("Cannot download file '%s' from S3 storage server (Access denied). Make sure that your credentials are right."
    847847                                  "Also check that your host clock is properly synced"),
    848                                pszFilename));
     848                               pszFilename);
    849849            else if (vrc == VERR_S3_NOT_FOUND)
    850                 DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    851                                tr("Cannot download file '%s' from S3 storage server (File not found)"), pszFilename));
     850                throw setError(VBOX_E_FILE_ERROR,
     851                               tr("Cannot download file '%s' from S3 storage server (File not found)"), pszFilename);
    852852            else
    853                 DebugBreakThrow(setError(VBOX_E_IPRT_ERROR,
    854                                tr("Cannot download file '%s' from S3 storage server (%Rrc)"), pszFilename, vrc));
     853                throw setError(VBOX_E_IPRT_ERROR,
     854                               tr("Cannot download file '%s' from S3 storage server (%Rrc)"), pszFilename, vrc);
    855855        }
    856856
     
    867867        /* Start the reading from the fs */
    868868        rc = readImpl(li, progress);
    869         if (FAILED(rc)) DebugBreakThrow(rc);
     869        if (FAILED(rc)) throw rc;
    870870
    871871        /* Unlock the appliance for the reading thread */
     
    980980
    981981                default:
    982                     DebugBreakThrow(setError(VBOX_E_NOT_SUPPORTED,
    983                                              tr("Invalid channel %RI16 specified; IDE controllers support only 0, 1 or 2"),
    984                                              ulAddressOnParent));
     982                    throw setError(VBOX_E_NOT_SUPPORTED,
     983                                   tr("Invalid channel %RI16 specified; IDE controllers support only 0, 1 or 2"),
     984                                   ulAddressOnParent);
    985985                break;
    986986            }
     
    10491049                       BstrFmt(tr("Importing appliance '%s'"), locInfo.strPath.c_str()),
    10501050                       mode);
    1051     if (FAILED(rc)) DebugBreakThrow(rc);
     1051    if (FAILED(rc)) throw rc;
    10521052
    10531053    /* Initialize our worker task */
     
    10551055
    10561056    rc = task->startThread();
    1057     if (FAILED(rc)) DebugBreakThrow(rc);
     1057    if (FAILED(rc)) throw rc;
    10581058
    10591059    /* Don't destruct on success */
     
    12181218        // if a manifest file exists, verify the content; we then need all files which are referenced by the OVF & the OVF itself
    12191219        rc = manifestVerify(pTask->locInfo, reader, pTask->pProgress);
    1220         if (FAILED(rc)) DebugBreakThrow(rc);
     1220        if (FAILED(rc)) throw rc;
    12211221
    12221222        // create a session for the machine + disks we manipulate below
    12231223        rc = stack.pSession.createInprocObject(CLSID_Session);
    1224         if (FAILED(rc)) DebugBreakThrow(rc);
     1224        if (FAILED(rc)) throw rc;
    12251225
    12261226        list<ovf::VirtualSystem>::const_iterator it;
     
    12511251            std::list<VirtualSystemDescriptionEntry*> vsdeName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
    12521252            if (vsdeName.size() < 1)
    1253                 DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1254                                          tr("Missing VM name")));
     1253                throw setError(VBOX_E_FILE_ERROR,
     1254                               tr("Missing VM name"));
    12551255            stack.strNameVBox = vsdeName.front()->strVboxCurrent;
    12561256
     
    12591259            vsdeOS = vsdescThis->findByType(VirtualSystemDescriptionType_OS);
    12601260            if (vsdeOS.size() < 1)
    1261                 DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1262                                          tr("Missing guest OS type")));
     1261                throw setError(VBOX_E_FILE_ERROR,
     1262                               tr("Missing guest OS type"));
    12631263            stack.strOsTypeVBox = vsdeOS.front()->strVboxCurrent;
    12641264
     
    12661266            std::list<VirtualSystemDescriptionEntry*> vsdeCPU = vsdescThis->findByType(VirtualSystemDescriptionType_CPU);
    12671267            if (vsdeCPU.size() != 1)
    1268                 DebugBreakThrow(setError(VBOX_E_FILE_ERROR, tr("CPU count missing")));
     1268                throw setError(VBOX_E_FILE_ERROR, tr("CPU count missing"));
    12691269
    12701270            const Utf8Str &cpuVBox = vsdeCPU.front()->strVboxCurrent;
     
    12801280            std::list<VirtualSystemDescriptionEntry*> vsdeRAM = vsdescThis->findByType(VirtualSystemDescriptionType_Memory);
    12811281            if (vsdeRAM.size() != 1)
    1282                 DebugBreakThrow(setError(VBOX_E_FILE_ERROR, tr("RAM size missing")));
     1282                throw setError(VBOX_E_FILE_ERROR, tr("RAM size missing"));
    12831283            const Utf8Str &memoryVBox = vsdeRAM.front()->strVboxCurrent;
    12841284            stack.ulMemorySizeMB = (uint32_t)RTStrToUInt64(memoryVBox.c_str());
     
    13841384        vrc = RTDirCreateTemp(pszTmpDir);
    13851385        if (RT_FAILURE(vrc))
    1386             DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1387                                      tr("Cannot create temporary directory '%s' (%Rrc)"), pszTmpDir, vrc));
     1386            throw setError(VBOX_E_FILE_ERROR,
     1387                           tr("Cannot create temporary directory '%s' (%Rrc)"), pszTmpDir, vrc);
    13881388
    13891389        /* Provide a OVF file (haven't to exist) so the import routine can
     
    14421442        li.strPath = strTmpOvf;
    14431443        rc = importImpl(li, progress);
    1444         if (FAILED(rc)) DebugBreakThrow(rc);
     1444        if (FAILED(rc)) throw rc;
    14451445
    14461446        /* Unlock the appliance for the fs import thread */
     
    15261526             || RTPathExists(strTargetPath.c_str())
    15271527           )
    1528             DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1529                                      tr("Destination file '%s' exists"),
    1530                                      strTargetPath.c_str()));
     1528            throw setError(VBOX_E_FILE_ERROR,
     1529                           tr("Destination file '%s' exists"),
     1530                           strTargetPath.c_str());
    15311531
    15321532        const Utf8Str &strSourceOVF = di.strHref;
     
    15341534        // Make sure target directory exists
    15351535        HRESULT rc = VirtualBox::ensureFilePathExists(strTargetPath.c_str());
    1536         if (FAILED(rc)) DebugBreakThrow(rc);
     1536        if (FAILED(rc)) throw rc;
    15371537
    15381538        // subprogress object for hard disk
     
    15541554                                             Bstr(strTargetPath),
    15551555                                             pTargetHD.asOutParam());
    1556             if (FAILED(rc)) DebugBreakThrow(rc);
     1556            if (FAILED(rc)) throw rc;
    15571557
    15581558            // create a dynamic growing disk image with the given capacity
    15591559            rc = pTargetHD->CreateBaseStorage(di.iCapacity / _1M, MediumVariant_Standard, pProgress2.asOutParam());
    1560             if (FAILED(rc)) DebugBreakThrow(rc);
     1560            if (FAILED(rc)) throw rc;
    15611561
    15621562            // advance to the next operation
     
    15701570            // source path must exist
    15711571            if (!RTPathExists(strSrcFilePath.c_str()))
    1572                 DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1573                                          tr("Source virtual disk image file '%s' doesn't exist"),
    1574                                          strSrcFilePath.c_str()));
     1572                throw setError(VBOX_E_FILE_ERROR,
     1573                               tr("Source virtual disk image file '%s' doesn't exist"),
     1574                               strSrcFilePath.c_str());
    15751575
    15761576            // Clone the disk image (this is necessary cause the id has
     
    15831583                                         AccessMode_ReadOnly,
    15841584                                         pSourceHD.asOutParam());
    1585             if (FAILED(rc)) DebugBreakThrow(rc);
     1585            if (FAILED(rc)) throw rc;
    15861586            fSourceHdNeedsClosing = true;
    15871587
     
    15891589            Bstr srcFormat;
    15901590            rc = pSourceHD->COMGETTER(Format)(srcFormat.asOutParam());
    1591             if (FAILED(rc)) DebugBreakThrow(rc);
     1591            if (FAILED(rc)) throw rc;
    15921592            /* Create a new hard disk interface for the destination disk image */
    15931593            rc = mVirtualBox->CreateHardDisk(srcFormat,
    15941594                                             Bstr(strTargetPath),
    15951595                                             pTargetHD.asOutParam());
    1596             if (FAILED(rc)) DebugBreakThrow(rc);
     1596            if (FAILED(rc)) throw rc;
    15971597            /* Clone the source disk image */
    15981598            rc = pSourceHD->CloneTo(pTargetHD, MediumVariant_Standard, NULL, pProgress2.asOutParam());
    1599             if (FAILED(rc)) DebugBreakThrow(rc);
     1599            if (FAILED(rc)) throw rc;
    16001600
    16011601            /* Advance to the next operation */
     
    16101610        {
    16111611            rc = pSourceHD->Close();
    1612             if (FAILED(rc)) DebugBreakThrow(rc);
     1612            if (FAILED(rc)) throw rc;
    16131613            fSourceHdNeedsClosing = false;
    16141614        }
     
    16491649    ComPtr<IGuestOSType> osType;
    16501650    rc = mVirtualBox->GetGuestOSType(Bstr(stack.strOsTypeVBox), osType.asOutParam());
    1651     if (FAILED(rc)) DebugBreakThrow(rc);
     1651    if (FAILED(rc)) throw rc;
    16521652
    16531653    /* Create the machine */
     
    16581658                                    FALSE,
    16591659                                    pNewMachine.asOutParam());
    1660     if (FAILED(rc)) DebugBreakThrow(rc);
     1660    if (FAILED(rc)) throw rc;
    16611661
    16621662    // set the description
     
    16641664    {
    16651665        rc = pNewMachine->COMSETTER(Description)(Bstr(stack.strDescription));
    1666         if (FAILED(rc)) DebugBreakThrow(rc);
     1666        if (FAILED(rc)) throw rc;
    16671667    }
    16681668
    16691669    // CPU count
    16701670    rc = pNewMachine->COMSETTER(CPUCount)(stack.cCPUs);
    1671     if (FAILED(rc)) DebugBreakThrow(rc);
     1671    if (FAILED(rc)) throw rc;
    16721672
    16731673    if (stack.fForceHWVirt)
    16741674    {
    16751675        rc = pNewMachine->SetHWVirtExProperty(HWVirtExPropertyType_Enabled, TRUE);
    1676         if (FAILED(rc)) DebugBreakThrow(rc);
     1676        if (FAILED(rc)) throw rc;
    16771677    }
    16781678
    16791679    // RAM
    16801680    rc = pNewMachine->COMSETTER(MemorySize)(stack.ulMemorySizeMB);
    1681     if (FAILED(rc)) DebugBreakThrow(rc);
     1681    if (FAILED(rc)) throw rc;
    16821682
    16831683    /* VRAM */
     
    16851685    ULONG vramVBox;
    16861686    rc = osType->COMGETTER(RecommendedVRAM)(&vramVBox);
    1687     if (FAILED(rc)) DebugBreakThrow(rc);
     1687    if (FAILED(rc)) throw rc;
    16881688
    16891689    /* Set the VRAM */
    16901690    rc = pNewMachine->COMSETTER(VRAMSize)(vramVBox);
    1691     if (FAILED(rc)) DebugBreakThrow(rc);
     1691    if (FAILED(rc)) throw rc;
    16921692
    16931693    // I/O APIC: Generic OVF has no setting for this. Enable it if we
     
    16991699        Bstr bstrFamilyId;
    17001700        rc = osType->COMGETTER(FamilyId)(bstrFamilyId.asOutParam());
    1701         if (FAILED(rc)) DebugBreakThrow(rc);
     1701        if (FAILED(rc)) throw rc;
    17021702        if (bstrFamilyId == "Windows")
    17031703            stack.fForceIOAPIC = true;
     
    17081708        ComPtr<IBIOSSettings> pBIOSSettings;
    17091709        rc = pNewMachine->COMGETTER(BIOSSettings)(pBIOSSettings.asOutParam());
    1710         if (FAILED(rc)) DebugBreakThrow(rc);
     1710        if (FAILED(rc)) throw rc;
    17111711
    17121712        rc = pBIOSSettings->COMSETTER(IOAPICEnabled)(TRUE);
    1713         if (FAILED(rc)) DebugBreakThrow(rc);
     1713        if (FAILED(rc)) throw rc;
    17141714    }
    17151715
     
    17201720            ComPtr<IAudioAdapter> audioAdapter;
    17211721            rc = pNewMachine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
    1722             if (FAILED(rc)) DebugBreakThrow(rc);
     1722            if (FAILED(rc)) throw rc;
    17231723            rc = audioAdapter->COMSETTER(Enabled)(true);
    1724             if (FAILED(rc)) DebugBreakThrow(rc);
     1724            if (FAILED(rc)) throw rc;
    17251725            rc = audioAdapter->COMSETTER(AudioController)(static_cast<AudioControllerType_T>(audio));
    1726             if (FAILED(rc)) DebugBreakThrow(rc);
     1726            if (FAILED(rc)) throw rc;
    17271727        }
    17281728
     
    17311731    ComPtr<IUSBController> usbController;
    17321732    rc = pNewMachine->COMGETTER(USBController)(usbController.asOutParam());
    1733     if (FAILED(rc)) DebugBreakThrow(rc);
     1733    if (FAILED(rc)) throw rc;
    17341734    rc = usbController->COMSETTER(Enabled)(stack.fUSBEnabled);
    1735     if (FAILED(rc)) DebugBreakThrow(rc);
     1735    if (FAILED(rc)) throw rc;
    17361736#endif /* VBOX_WITH_USB */
    17371737
     
    17431743        ComPtr<INetworkAdapter> nwVBox;
    17441744        rc = pNewMachine->GetNetworkAdapter(0, nwVBox.asOutParam());
    1745         if (FAILED(rc)) DebugBreakThrow(rc);
     1745        if (FAILED(rc)) throw rc;
    17461746        rc = nwVBox->COMSETTER(Enabled)(false);
    1747         if (FAILED(rc)) DebugBreakThrow(rc);
     1747        if (FAILED(rc)) throw rc;
    17481748    }
    17491749    else if (vsdeNW.size() > SchemaDefs::NetworkAdapterCount)
    1750         DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1751                                  tr("Too many network adapters: OVF requests %d network adapters, but VirtualBox only supports %d"),
    1752                                  vsdeNW.size(), SchemaDefs::NetworkAdapterCount));
     1750        throw setError(VBOX_E_FILE_ERROR,
     1751                       tr("Too many network adapters: OVF requests %d network adapters, but VirtualBox only supports %d"),
     1752                       vsdeNW.size(), SchemaDefs::NetworkAdapterCount);
    17531753    else
    17541754    {
     
    17651765            ComPtr<INetworkAdapter> pNetworkAdapter;
    17661766            rc = pNewMachine->GetNetworkAdapter((ULONG)a, pNetworkAdapter.asOutParam());
    1767             if (FAILED(rc)) DebugBreakThrow(rc);
     1767            if (FAILED(rc)) throw rc;
    17681768            /* Enable the network card & set the adapter type */
    17691769            rc = pNetworkAdapter->COMSETTER(Enabled)(true);
    1770             if (FAILED(rc)) DebugBreakThrow(rc);
     1770            if (FAILED(rc)) throw rc;
    17711771            rc = pNetworkAdapter->COMSETTER(AdapterType)(static_cast<NetworkAdapterType_T>(tt1));
    1772             if (FAILED(rc)) DebugBreakThrow(rc);
     1772            if (FAILED(rc)) throw rc;
    17731773
    17741774            // default is NAT; change to "bridged" if extra conf says so
     
    17771777                /* Attach to the right interface */
    17781778                rc = pNetworkAdapter->AttachToBridgedInterface();
    1779                 if (FAILED(rc)) DebugBreakThrow(rc);
     1779                if (FAILED(rc)) throw rc;
    17801780                ComPtr<IHost> host;
    17811781                rc = mVirtualBox->COMGETTER(Host)(host.asOutParam());
    1782                 if (FAILED(rc)) DebugBreakThrow(rc);
     1782                if (FAILED(rc)) throw rc;
    17831783                com::SafeIfaceArray<IHostNetworkInterface> nwInterfaces;
    17841784                rc = host->COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(nwInterfaces));
    1785                 if (FAILED(rc)) DebugBreakThrow(rc);
     1785                if (FAILED(rc)) throw rc;
    17861786                // We search for the first host network interface which
    17871787                // is usable for bridged networking
     
    17921792                    HostNetworkInterfaceType_T itype;
    17931793                    rc = nwInterfaces[j]->COMGETTER(InterfaceType)(&itype);
    1794                     if (FAILED(rc)) DebugBreakThrow(rc);
     1794                    if (FAILED(rc)) throw rc;
    17951795                    if (itype == HostNetworkInterfaceType_Bridged)
    17961796                    {
    17971797                        Bstr name;
    17981798                        rc = nwInterfaces[j]->COMGETTER(Name)(name.asOutParam());
    1799                         if (FAILED(rc)) DebugBreakThrow(rc);
     1799                        if (FAILED(rc)) throw rc;
    18001800                        /* Set the interface name to attach to */
    18011801                        pNetworkAdapter->COMSETTER(HostInterface)(name);
    1802                         if (FAILED(rc)) DebugBreakThrow(rc);
     1802                        if (FAILED(rc)) throw rc;
    18031803                        break;
    18041804                    }
     
    18101810                /* Attach to the right interface */
    18111811                rc = pNetworkAdapter->AttachToHostOnlyInterface();
    1812                 if (FAILED(rc)) DebugBreakThrow(rc);
     1812                if (FAILED(rc)) throw rc;
    18131813                ComPtr<IHost> host;
    18141814                rc = mVirtualBox->COMGETTER(Host)(host.asOutParam());
    1815                 if (FAILED(rc)) DebugBreakThrow(rc);
     1815                if (FAILED(rc)) throw rc;
    18161816                com::SafeIfaceArray<IHostNetworkInterface> nwInterfaces;
    18171817                rc = host->COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(nwInterfaces));
    1818                 if (FAILED(rc)) DebugBreakThrow(rc);
     1818                if (FAILED(rc)) throw rc;
    18191819                // We search for the first host network interface which
    18201820                // is usable for host only networking
     
    18251825                    HostNetworkInterfaceType_T itype;
    18261826                    rc = nwInterfaces[j]->COMGETTER(InterfaceType)(&itype);
    1827                     if (FAILED(rc)) DebugBreakThrow(rc);
     1827                    if (FAILED(rc)) throw rc;
    18281828                    if (itype == HostNetworkInterfaceType_HostOnly)
    18291829                    {
    18301830                        Bstr name;
    18311831                        rc = nwInterfaces[j]->COMGETTER(Name)(name.asOutParam());
    1832                         if (FAILED(rc)) DebugBreakThrow(rc);
     1832                        if (FAILED(rc)) throw rc;
    18331833                        /* Set the interface name to attach to */
    18341834                        pNetworkAdapter->COMSETTER(HostInterface)(name);
    1835                         if (FAILED(rc)) DebugBreakThrow(rc);
     1835                        if (FAILED(rc)) throw rc;
    18361836                        break;
    18371837                    }
     
    18471847    uint32_t cIDEControllers = vsdeHDCIDE.size();
    18481848    if (cIDEControllers > 2)
    1849         DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1850                                  tr("Too many IDE controllers in OVF; import facility only supports two")));
     1849        throw setError(VBOX_E_FILE_ERROR,
     1850                       tr("Too many IDE controllers in OVF; import facility only supports two"));
    18511851    if (vsdeHDCIDE.size() > 0)
    18521852    {
     
    18541854        ComPtr<IStorageController> pController;
    18551855        rc = pNewMachine->AddStorageController(Bstr("IDE Controller"), StorageBus_IDE, pController.asOutParam());
    1856         if (FAILED(rc)) DebugBreakThrow(rc);
     1856        if (FAILED(rc)) throw rc;
    18571857
    18581858        const char *pcszIDEType = vsdeHDCIDE.front()->strVboxCurrent.c_str();
     
    18641864            rc = pController->COMSETTER(ControllerType)(StorageControllerType_ICH6);
    18651865        else
    1866             DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1867                                      tr("Invalid IDE controller type \"%s\""),
    1868                                      pcszIDEType));
    1869         if (FAILED(rc)) DebugBreakThrow(rc);
     1866            throw setError(VBOX_E_FILE_ERROR,
     1867                           tr("Invalid IDE controller type \"%s\""),
     1868                           pcszIDEType);
     1869        if (FAILED(rc)) throw rc;
    18701870    }
    18711871
     
    18731873    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSATA = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerSATA);
    18741874    if (vsdeHDCSATA.size() > 1)
    1875         DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1876                                  tr("Too many SATA controllers in OVF; import facility only supports one")));
     1875        throw setError(VBOX_E_FILE_ERROR,
     1876                       tr("Too many SATA controllers in OVF; import facility only supports one"));
    18771877    if (vsdeHDCSATA.size() > 0)
    18781878    {
     
    18821882        {
    18831883            rc = pNewMachine->AddStorageController(Bstr("SATA Controller"), StorageBus_SATA, pController.asOutParam());
    1884             if (FAILED(rc)) DebugBreakThrow(rc);
     1884            if (FAILED(rc)) throw rc;
    18851885        }
    18861886        else
    1887             DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1888                                      tr("Invalid SATA controller type \"%s\""),
    1889                                      hdcVBox.c_str()));
     1887            throw setError(VBOX_E_FILE_ERROR,
     1888                           tr("Invalid SATA controller type \"%s\""),
     1889                           hdcVBox.c_str());
    18901890    }
    18911891
     
    18931893    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSCSI = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerSCSI);
    18941894    if (vsdeHDCSCSI.size() > 1)
    1895         DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1896                                  tr("Too many SCSI controllers in OVF; import facility only supports one")));
     1895        throw setError(VBOX_E_FILE_ERROR,
     1896                       tr("Too many SCSI controllers in OVF; import facility only supports one"));
    18971897    if (vsdeHDCSCSI.size() > 0)
    18981898    {
     
    19141914            controllerType = StorageControllerType_BusLogic;
    19151915        else
    1916             DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1917                                      tr("Invalid SCSI controller type \"%s\""),
    1918                                      hdcVBox.c_str()));
     1916            throw setError(VBOX_E_FILE_ERROR,
     1917                           tr("Invalid SCSI controller type \"%s\""),
     1918                           hdcVBox.c_str());
    19191919
    19201920        rc = pNewMachine->AddStorageController(bstrName, busType, pController.asOutParam());
    1921         if (FAILED(rc)) DebugBreakThrow(rc);
     1921        if (FAILED(rc)) throw rc;
    19221922        rc = pController->COMSETTER(ControllerType)(controllerType);
    1923         if (FAILED(rc)) DebugBreakThrow(rc);
     1923        if (FAILED(rc)) throw rc;
    19241924    }
    19251925
     
    19271927    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSAS = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerSAS);
    19281928    if (vsdeHDCSAS.size() > 1)
    1929         DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1930                                  tr("Too many SAS controllers in OVF; import facility only supports one")));
     1929        throw setError(VBOX_E_FILE_ERROR,
     1930                       tr("Too many SAS controllers in OVF; import facility only supports one"));
    19311931    if (vsdeHDCSAS.size() > 0)
    19321932    {
    19331933        ComPtr<IStorageController> pController;
    19341934        rc = pNewMachine->AddStorageController(Bstr(L"SAS Controller"), StorageBus_SAS, pController.asOutParam());
    1935         if (FAILED(rc)) DebugBreakThrow(rc);
     1935        if (FAILED(rc)) throw rc;
    19361936        rc = pController->COMSETTER(ControllerType)(StorageControllerType_LsiLogicSas);
    1937         if (FAILED(rc)) DebugBreakThrow(rc);
     1937        if (FAILED(rc)) throw rc;
    19381938    }
    19391939
    19401940    /* Now its time to register the machine before we add any hard disks */
    19411941    rc = mVirtualBox->RegisterMachine(pNewMachine);
    1942     if (FAILED(rc)) DebugBreakThrow(rc);
     1942    if (FAILED(rc)) throw rc;
    19431943
    19441944    // store new machine for roll-back in case of errors
    19451945    Bstr bstrNewMachineId;
    19461946    rc = pNewMachine->COMGETTER(Id)(bstrNewMachineId.asOutParam());
    1947     if (FAILED(rc)) DebugBreakThrow(rc);
     1947    if (FAILED(rc)) throw rc;
    19481948    Guid uuidNewMachine(bstrNewMachineId);
    19491949    m->llGuidsMachinesCreated.push_back(uuidNewMachine);
     
    19521952    std::list<VirtualSystemDescriptionEntry*> vsdeFloppy = vsdescThis->findByType(VirtualSystemDescriptionType_Floppy);
    19531953    if (vsdeFloppy.size() > 1)
    1954         DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    1955                                  tr("Too many floppy controllers in OVF; import facility only supports one")));
     1954        throw setError(VBOX_E_FILE_ERROR,
     1955                       tr("Too many floppy controllers in OVF; import facility only supports one"));
    19561956    std::list<VirtualSystemDescriptionEntry*> vsdeCDROM = vsdescThis->findByType(VirtualSystemDescriptionType_CDROM);
    19571957    if (    (vsdeFloppy.size() > 0)
     
    19661966            // to attach things we need to open a session for the new machine
    19671967            rc = pNewMachine->LockMachine(stack.pSession, LockType_Write);
    1968             if (FAILED(rc)) DebugBreakThrow(rc);
     1968            if (FAILED(rc)) throw rc;
    19691969            stack.fSessionOpen = true;
    19701970
    19711971            ComPtr<IMachine> sMachine;
    19721972            rc = stack.pSession->COMGETTER(Machine)(sMachine.asOutParam());
    1973             if (FAILED(rc)) DebugBreakThrow(rc);
     1973            if (FAILED(rc)) throw rc;
    19741974
    19751975            // floppy first
     
    19781978                ComPtr<IStorageController> pController;
    19791979                rc = sMachine->AddStorageController(Bstr("Floppy Controller"), StorageBus_Floppy, pController.asOutParam());
    1980                 if (FAILED(rc)) DebugBreakThrow(rc);
     1980                if (FAILED(rc)) throw rc;
    19811981
    19821982                Bstr bstrName;
    19831983                rc = pController->COMGETTER(Name)(bstrName.asOutParam());
    1984                 if (FAILED(rc)) DebugBreakThrow(rc);
     1984                if (FAILED(rc)) throw rc;
    19851985
    19861986                // this is for rollback later
     
    19981998                                            DeviceType_Floppy,
    19991999                                            NULL);
    2000                 if (FAILED(rc)) DebugBreakThrow(rc);
     2000                if (FAILED(rc)) throw rc;
    20012001
    20022002                stack.llHardDiskAttachments.push_back(mhda);
     
    20262026
    20272027                if (!pController)
    2028                     DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    2029                                              tr("OVF wants a CD-ROM drive but cannot find IDE controller, which is required in this version of VirtualBox")));
     2028                    throw setError(VBOX_E_FILE_ERROR,
     2029                                   tr("OVF wants a CD-ROM drive but cannot find IDE controller, which is required in this version of VirtualBox"));
    20302030
    20312031                // this is for rollback later
     
    20462046                                            DeviceType_DVD,
    20472047                                            NULL);
    2048                 if (FAILED(rc)) DebugBreakThrow(rc);
     2048                if (FAILED(rc)) throw rc;
    20492049
    20502050                stack.llHardDiskAttachments.push_back(mhda);
     
    20522052
    20532053            rc = sMachine->SaveSettings();
    2054             if (FAILED(rc)) DebugBreakThrow(rc);
     2054            if (FAILED(rc)) throw rc;
    20552055
    20562056            // only now that we're done with all disks, close the session
    20572057            rc = stack.pSession->UnlockMachine();
    2058             if (FAILED(rc)) DebugBreakThrow(rc);
     2058            if (FAILED(rc)) throw rc;
    20592059            stack.fSessionOpen = false;
    20602060        }
     
    20782078            // to attach things we need to open a session for the new machine
    20792079            rc = pNewMachine->LockMachine(stack.pSession, LockType_Write);
    2080             if (FAILED(rc)) DebugBreakThrow(rc);
     2080            if (FAILED(rc)) throw rc;
    20812081            stack.fSessionOpen = true;
    20822082
     
    20972097                     || (itDiskImage == stack.mapDisks.end())
    20982098                   )
    2099                     DebugBreakThrow(setError(E_FAIL,
    2100                                              tr("Internal inconsistency looking up disk image '%s'"),
    2101                                              vsdeHD->strRef.c_str()));
     2099                    throw setError(E_FAIL,
     2100                                   tr("Internal inconsistency looking up disk image '%s'"),
     2101                                   vsdeHD->strRef.c_str());
    21022102
    21032103                const ovf::DiskImage &ovfDiskImage = itDiskImage->second;
     
    21132113                ComPtr<IMachine> sMachine;
    21142114                rc = stack.pSession->COMGETTER(Machine)(sMachine.asOutParam());
    2115                 if (FAILED(rc)) DebugBreakThrow(rc);
     2115                if (FAILED(rc)) throw rc;
    21162116
    21172117                // find the hard disk controller to which we should attach
     
    21352135                                            DeviceType_HardDisk,    // DeviceType_T type
    21362136                                            pTargetHD);
    2137                 if (FAILED(rc)) DebugBreakThrow(rc);
     2137                if (FAILED(rc)) throw rc;
    21382138
    21392139                stack.llHardDiskAttachments.push_back(mhda);
    21402140
    21412141                rc = sMachine->SaveSettings();
    2142                 if (FAILED(rc)) DebugBreakThrow(rc);
     2142                if (FAILED(rc)) throw rc;
    21432143            } // end for (itHD = avsdeHDs.begin();
    21442144
    21452145            // only now that we're done with all disks, close the session
    21462146            rc = stack.pSession->UnlockMachine();
    2147             if (FAILED(rc)) DebugBreakThrow(rc);
     2147            if (FAILED(rc)) throw rc;
    21482148            stack.fSessionOpen = false;
    21492149        }
     
    21972197    Utf8Str strDefaultHardDiskFolder;
    21982198    HRESULT rc = getDefaultHardDiskFolder(strDefaultHardDiskFolder);
    2199     if (FAILED(rc)) DebugBreakThrow(rc);
     2199    if (FAILED(rc)) throw rc;
    22002200
    22012201    /*
     
    23082308                    Bstr hdId;
    23092309                    rc = pTargetHD->COMGETTER(Id)(hdId.asOutParam());
    2310                     if (FAILED(rc)) DebugBreakThrow(rc);
     2310                    if (FAILED(rc)) throw rc;
    23112311
    23122312                    d.uuid = hdId;
     
    23192319            // no disk with such a UUID found:
    23202320            if (!fFound)
    2321                 DebugBreakThrow(setError(E_FAIL,
    2322                                          tr("<vbox:Machine> element in OVF contains a medium attachment for the disk image %s but the OVF describes no such image"),
    2323                                          strUuid.c_str()));
     2321                throw setError(E_FAIL,
     2322                               tr("<vbox:Machine> element in OVF contains a medium attachment for the disk image %s but the OVF describes no such image"),
     2323                               strUuid.c_str());
    23242324        } // for (settings::AttachedDevicesList::const_iterator dit = sc.llAttachedDevices.begin();
    23252325    } // for (settings::StorageControllersList::const_iterator sit = config.storageMachine.llStorageControllers.begin();
     
    23332333    ComObjPtr<Machine> pNewMachine;
    23342334    rc = pNewMachine.createObject();
    2335     if (FAILED(rc)) DebugBreakThrow(rc);
     2335    if (FAILED(rc)) throw rc;
    23362336
    23372337    // this magic constructor fills the new machine object with the MachineConfig
     
    23402340                           stack.strNameVBox,       // name from OVF preparations; can be suffixed to avoid duplicates, or changed by user
    23412341                           config);                 // the whole machine config
    2342     if (FAILED(rc)) DebugBreakThrow(rc);
     2342    if (FAILED(rc)) throw rc;
    23432343
    23442344    // return the new machine as an IMachine
    23452345    IMachine *p;
    23462346    rc = pNewMachine.queryInterfaceTo(&p);
    2347     if (FAILED(rc)) DebugBreakThrow(rc);
     2347    if (FAILED(rc)) throw rc;
    23482348    pReturnNewMachine = p;
    23492349
    23502350    // and register it
    23512351    rc = mVirtualBox->RegisterMachine(pNewMachine);
    2352     if (FAILED(rc)) DebugBreakThrow(rc);
     2352    if (FAILED(rc)) throw rc;
    23532353
    23542354    // store new machine for roll-back in case of errors
    23552355    Bstr bstrNewMachineId;
    23562356    rc = pNewMachine->COMGETTER(Id)(bstrNewMachineId.asOutParam());
    2357     if (FAILED(rc)) DebugBreakThrow(rc);
     2357    if (FAILED(rc)) throw rc;
    23582358    m->llGuidsMachinesCreated.push_back(Guid(bstrNewMachineId));
    23592359}
     
    23972397        vrc = RTDirCreateTemp(pszTmpDir);
    23982398        if (RT_FAILURE(vrc))
    2399             DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    2400                                      tr("Cannot create temporary directory '%s' (%Rrc)"), pszTmpDir, vrc));
     2399            throw setError(VBOX_E_FILE_ERROR,
     2400                           tr("Cannot create temporary directory '%s' (%Rrc)"), pszTmpDir, vrc);
    24012401
    24022402        /* Add every disks of every virtual system to an internal list */
     
    24262426        vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(), pTask->locInfo.strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
    24272427        if (RT_FAILURE(vrc))
    2428             DebugBreakThrow(setError(VBOX_E_IPRT_ERROR,
    2429                                      tr("Cannot create S3 service handler")));
     2428            throw setError(VBOX_E_IPRT_ERROR,
     2429                           tr("Cannot create S3 service handler"));
    24302430        RTS3SetProgressCallback(hS3, pTask->updateProgress, &pTask);
    24312431
     
    24472447                    throw S_OK; /* todo: !!!!!!!!!!!!! */
    24482448                else if (vrc == VERR_S3_ACCESS_DENIED)
    2449                     DebugBreakThrow(setError(E_ACCESSDENIED,
    2450                                              tr("Cannot download file '%s' from S3 storage server (Access denied). "
    2451                                                 "Make sure that your credentials are right. Also check that your host clock is properly synced"),
    2452                                              pszFilename));
     2449                    throw setError(E_ACCESSDENIED,
     2450                                   tr("Cannot download file '%s' from S3 storage server (Access denied). "
     2451                                      "Make sure that your credentials are right. Also check that your host clock is properly synced"),
     2452                                   pszFilename);
    24532453                else if (vrc == VERR_S3_NOT_FOUND)
    2454                     DebugBreakThrow(setError(VBOX_E_FILE_ERROR,
    2455                                              tr("Cannot download file '%s' from S3 storage server (File not found)"),
    2456                                              pszFilename));
     2454                    throw setError(VBOX_E_FILE_ERROR,
     2455                                   tr("Cannot download file '%s' from S3 storage server (File not found)"),
     2456                                   pszFilename);
    24572457                else
    2458                     DebugBreakThrow(setError(VBOX_E_IPRT_ERROR,
    2459                                              tr("Cannot download file '%s' from S3 storage server (%Rrc)"),
    2460                                              pszFilename, vrc));
     2458                    throw setError(VBOX_E_IPRT_ERROR,
     2459                                   tr("Cannot download file '%s' from S3 storage server (%Rrc)"),
     2460                                   pszFilename, vrc);
    24612461            }
    24622462        }
     
    24822482                vrc = VINF_SUCCESS; /* Not found is ok */
    24832483            else if (vrc == VERR_S3_ACCESS_DENIED)
    2484                 DebugBreakThrow(setError(E_ACCESSDENIED,
    2485                                          tr("Cannot download file '%s' from S3 storage server (Access denied)."
    2486                                             "Make sure that your credentials are right. Also check that your host clock is properly synced"),
    2487                                          pszFilename));
     2484                throw setError(E_ACCESSDENIED,
     2485                               tr("Cannot download file '%s' from S3 storage server (Access denied)."
     2486                                  "Make sure that your credentials are right. Also check that your host clock is properly synced"),
     2487                               pszFilename);
    24882488            else
    2489                 DebugBreakThrow(setError(VBOX_E_IPRT_ERROR,
    2490                                          tr("Cannot download file '%s' from S3 storage server (%Rrc)"),
    2491                                          pszFilename, vrc));
     2489                throw setError(VBOX_E_IPRT_ERROR,
     2490                               tr("Cannot download file '%s' from S3 storage server (%Rrc)"),
     2491                               pszFilename, vrc);
    24922492        }
    24932493
     
    25032503        li.strPath = strTmpOvf;
    25042504        rc = importImpl(li, progress);
    2505         if (FAILED(rc)) DebugBreakThrow(rc);
     2505        if (FAILED(rc)) throw rc;
    25062506
    25072507        /* Unlock the appliance for the fs import thread */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette