VirtualBox

Changeset 73221 in vbox


Ignore:
Timestamp:
Jul 18, 2018 6:29:01 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123826
Message:

bugref:9152. Fixed tangle between COM errors and VirtualBox errors.

Location:
trunk/src/VBox/Main/src-server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/CloudClientImpl.cpp

    r73216 r73221  
    5151}
    5252
    53 //CloudClient::CloudClient(CloudProviderId_T aCloudProvider)
    54 //    : mParent(NULL)
    55 //{
    56 //    LogRel(("CloudClient::CloudClient(CloudProviderId_T %d)\n", mCloudProvider));
    57 //    mCloudProvider = aCloudProvider;
    58 //}
    59 
    6053HRESULT CloudClient::FinalConstruct()
    6154{
     
    130123        if (FAILED(hrc))
    131124        {
    132             throw hrc;
     125            return hrc;
    133126        }
    134127
     
    171164{
    172165    LogRel(("CloudClient::getOperationParameters: %d, %s\n", aCloudOperation, aJsonString.c_str()));
    173     HRESULT hrc = VERR_NOT_IMPLEMENTED;
    174 
     166    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    175167    return hrc;
    176168}
     
    183175            aCloudOperation,
    184176            aOpId.toString().c_str()));
    185     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     177    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    186178    return hrc;
    187179}
     
    191183{
    192184    LogRel(("CloudClient::runOperation: %s, %d\n", aOpId.toString().c_str(), aTimeout));
    193     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     185    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    194186    return hrc;
    195187}
     
    205197            *aLastTime,
    206198            *aResult));
    207     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     199    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    208200    return hrc;
    209201}
     
    214206    LogRel(("CloudClient::getOperationParameterNames: %d\n", aCloudOperation));
    215207    aParameterNames.clear();
    216     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     208    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    217209    return hrc;
    218210}
     
    228220            aOpParameterDesc.c_str()));
    229221    aOpParameterValues.clear();
    230     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     222    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    231223    return hrc;
    232224}
     
    241233    }
    242234
    243     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     235    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    244236    return hrc;
    245237}
     
    286278        if (FAILED(hrc))
    287279        {
    288             throw hrc;
     280            return hrc;
    289281        }
    290282
     
    427419        aJsonString = strExportParametersToOCI;
    428420    else
    429         hrc = VERR_NOT_IMPLEMENTED;
     421        hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    430422    return hrc;
    431423}
     
    438430            aCloudOperation,
    439431            aOpId.toString().c_str()));
    440     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     432    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    441433    return hrc;
    442434}
     
    446438{
    447439    LogRel(("CloudClientOCI::runOperation: %s, %d\n", aOpId.toString().c_str(), aTimeout));
    448     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     440    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    449441    return hrc;
    450442}
     
    460452            *aLastTime,
    461453            *aResult));
    462     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     454    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    463455    return hrc;
    464456}
     
    469461    LogRel(("CloudClientOCI::getOperationParameterNames: %d\n", aCloudOperation));
    470462    aParameterNames.clear();
    471     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     463    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    472464    return hrc;
    473465}
     
    483475            aOpParameterDesc.c_str()));
    484476    aOpParameterValues.clear();
    485     HRESULT hrc = VERR_NOT_IMPLEMENTED;
     477    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    486478    return hrc;
    487479}
     
    496488    }
    497489
    498     HRESULT hrc = VERR_NOT_IMPLEMENTED;
    499     return hrc;
    500 }
    501 
     490    HRESULT hrc = setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
     491    return hrc;
     492}
     493
  • trunk/src/VBox/Main/src-server/CloudUserProfileListImpl.cpp

    r73218 r73221  
    132132        {
    133133            LogRel(("There are not any sections in the config\n"));
    134             hrc = VWRN_NOT_FOUND;
     134            hrc = E_FAIL;
    135135        }
    136136        else //the last section hasn't a close tag (the close tag is just the beginning of next section)
     
    149149    HRESULT hrc = S_OK;
    150150    if (aSectionName.isEmpty())
    151         hrc = VERR_INVALID_PARAMETER; /** @todo r=bird: You're mixing error codes... */
     151        hrc = E_FAIL;
    152152    else
    153153        mSections.insert(make_pair(aSectionName, section));
     
    263263    LogRel(("CloudUserProfileList::getSupportedPropertiesNames:\n"));
    264264    aPropertiesNames.clear();
    265     return VERR_NOT_IMPLEMENTED;
     265    return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    266266}
    267267
     
    269269{
    270270    LogRel(("CloudUserProfileList::readProfiles: %s\n", strConfigPath.c_str()));
    271     return VERR_NOT_IMPLEMENTED;
     271    return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    272272}
    273273
     
    276276    *aProvider = CloudProviderId_Unknown;
    277277    LogRel(("CloudUserProfileList::getProvider: %d\n", *aProvider));
    278     return VERR_NOT_IMPLEMENTED;
     278    return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    279279}
    280280
     
    284284{
    285285    LogRel(("CloudUserProfileList::createProfile: %s, %d, %d\n", aProfileName.c_str(), aNames.size(), aValues.size()));
    286     return VERR_NOT_IMPLEMENTED;
     286    return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    287287}
    288288
     
    292292{
    293293    LogRel(("CloudUserProfileList::updateProfile: %s, %d, %d\n", aProfileName.c_str(), aNames.size(), aValues.size()));
    294     return VERR_NOT_IMPLEMENTED;
     294    return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    295295}
    296296
     
    300300    LogRel(("CloudUserProfileList::getStoredProfilesNames:\n"));
    301301    aProfilesNames.clear();
    302     return VERR_NOT_IMPLEMENTED;
     302    return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    303303}
    304304
     
    310310    aReturnNames.clear();
    311311    aReturnValues.clear();
    312     return VERR_NOT_IMPLEMENTED;
     312    return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    313313}
    314314
     
    317317{
    318318    LogRel(("CloudUserProfileList::getPropertyDescription: %s, %s\n", aName.c_str(), aDescription.c_str()));
    319     return VERR_NOT_IMPLEMENTED;
     319    return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    320320}
    321321
     
    330330    }
    331331
    332     return VERR_NOT_IMPLEMENTED;
     332    return setErrorBoth(E_FAIL, VERR_NOT_IMPLEMENTED, tr("Not implemented"));
    333333}
    334334
     
    408408            if (FAILED(hrc))
    409409            {
    410                 throw hrc; /** @todo r=bird: WTF? Try return it! */
     410                return hrc;
    411411            }
    412412            LogRel(("Successfully parsed %d profiles\n", mpProfiles->getNumberOfSections()));
     
    416416    {
    417417        LogRel(("Empty path to config file\n"));
    418         hrc = VERR_INVALID_PARAMETER; /** @todo r=bird: You're mixing error codes... */
     418        hrc = setErrorBoth(E_FAIL, VERR_INVALID_PARAMETER, tr("Empty path to config file"));
    419419    }
    420420
     
    441441    }
    442442    else
    443         hrc = VERR_ALREADY_EXISTS;
     443        hrc = setErrorBoth(E_FAIL, VERR_ALREADY_EXISTS, tr("Profile '%s' has already exested"), aProfileName.c_str());
    444444
    445445    return hrc;
     
    464464    }
    465465    else
    466         hrc = VERR_NOT_FOUND; /** @todo r=bird: You're mixing error codes... */
     466        hrc = setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Profile '%s' wasn't found"), aProfileName.c_str());
    467467
    468468    return hrc;
     
    474474    aProfilesNames = mpProfiles->getSectionsNames();
    475475    if (aProfilesNames.empty())
    476         hrc = VERR_NOT_FOUND; /** @todo r=bird: You're mixing error codes... */
     476        hrc = setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("There aren't any profiles in the config"));
    477477
    478478    return hrc;
     
    503503    }
    504504    else
    505         hrc = VERR_NOT_FOUND; /** @todo r=bird: You're mixing error codes... */
     505        hrc = setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Profile '%s' wasn't found"), aProfileName.c_str());
    506506
    507507    return hrc;
     
    545545        hrc = mpProfiles->updateSection(aProfileName, aProfile);
    546546    else
    547         hrc = VERR_NOT_FOUND; /** @todo r=bird: You're mixing error codes... */
     547        hrc = setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Profile '%s' wasn't found"), aProfileName.c_str());
     548
    548549
    549550    return hrc;
     
    572573        aProfile = reqProfile;
    573574    else
    574         hrc = VERR_NOT_FOUND; /** @todo r=bird: You're mixing error codes... */
    575 
    576     return hrc;
    577 }
    578 
     575        hrc = setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Profile '%s' wasn't found"), aProfileName.c_str());
     576
     577    return hrc;
     578}
     579
  • trunk/src/VBox/Main/src-server/CloudUserProfileManagerImpl.cpp

    r73218 r73221  
    147147                        }
    148148                        else
    149                             /** @todo r=bird: You are constantly mixing up status codes.
    150                              * VERR_FILE_NOT_FOUND, VERR_INVALID_PARAMETER and VERR_NOT_FOUND are all VBox
    151                              * status codes.  They don't work for HRESULT types, because that's for
    152                              * COM/XPCOM status codes.   Here you should use setErrorBoth or setErrorVrc. */
    153                             hrc = setError(VERR_FILE_NOT_FOUND, tr("Could not locate the config file '%s'"), szOciConfigPath);
     149                            hrc = setErrorBoth(E_FAIL, VERR_FILE_NOT_FOUND, tr("Could not locate the config file '%s'"),
     150                                               szOciConfigPath);
    154151                    }
    155152                    else
Note: See TracChangeset for help on using the changeset viewer.

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