VirtualBox

Ignore:
Timestamp:
Jan 7, 2009 2:17:56 PM (16 years ago)
Author:
vboxsync
Message:

#3285: Improve error handling API to include unique error numbers
Document InternalSessionControl's

  • getRemoteConsole
  • assignMachine
  • assignRemoteMachine
  • updateMachineState
  • uninitialize
  • onDVDDriveChange
  • onFloppyDriveChange
  • onNetworkAdapterChange
  • onSerialPortChange
  • onParallelPortChange
  • onVRDPServerChange
  • onUSBControllerChange
  • onSharedFolderChange
  • onUSBDeviceAttach
  • onUSBDeviceDetach
  • onShowWindow
  • accessGuestProperty
  • enumerateGuestProperties
File:
1 edited

Legend:

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

    r15140 r15834  
    266266    AutoReadLock alock (this);
    267267
    268     AssertReturn (mState != SessionState_Closed, E_FAIL);
     268    AssertReturn (mState != SessionState_Closed, VBOX_E_INVALID_VM_STATE);
    269269
    270270    AssertMsgReturn (mType == SessionType_Direct && !!mConsole,
    271                      ("This is not a direct session!\n"), E_FAIL);
     271      ("This is not a direct session!\n"), VBOX_E_INVALID_OBJECT_STATE);
    272272
    273273    /* return a failure if the session already transitioned to Closing
    274274     * but the server hasn't processed Machine::OnSessionEnd() yet. */
    275275    if (mState != SessionState_Open)
    276         return E_UNEXPECTED;
     276        return VBOX_E_INVALID_VM_STATE;
    277277
    278278    mConsole.queryInterfaceTo (aConsole);
     
    291291    AutoWriteLock alock (this);
    292292
    293     AssertReturn (mState == SessionState_Closed, E_FAIL);
     293    AssertReturn (mState == SessionState_Closed, VBOX_E_INVALID_VM_STATE);
    294294
    295295    if (!aMachine)
     
    302302         */
    303303
    304         AssertReturn (mType == SessionType_Null, E_FAIL);
     304        AssertReturn (mType == SessionType_Null, VBOX_E_INVALID_OBJECT_STATE);
    305305        mType = SessionType_Remote;
    306306        mState = SessionState_Spawning;
     
    363363
    364364    AssertReturn (mState == SessionState_Closed ||
    365                   mState == SessionState_Spawning, E_FAIL);
     365                  mState == SessionState_Spawning, VBOX_E_INVALID_VM_STATE);
    366366
    367367    HRESULT rc = E_FAIL;
     
    369369    /* query IInternalMachineControl interface */
    370370    mControl = aMachine;
    371     AssertReturn (!!mControl, E_FAIL);
     371    AssertReturn (!!mControl, E_FAIL); // This test appears to be redundant --JS
    372372
    373373    /// @todo (dmik)
     
    445445    }
    446446
    447     AssertReturn (mState == SessionState_Open &&
    448                   mType == SessionType_Direct, E_FAIL);
     447    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     448    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    449449
    450450    AssertReturn (!mControl.isNull(), E_FAIL);
     
    476476
    477477        AssertReturn (mState == SessionState_Open ||
    478                       mState == SessionState_Spawning, E_FAIL);
     478                      mState == SessionState_Spawning, VBOX_E_INVALID_VM_STATE);
    479479
    480480        /* close ourselves */
     
    509509
    510510    AutoReadLock alock (this);
    511     AssertReturn (mState == SessionState_Open &&
    512                   mType == SessionType_Direct, E_FAIL);
     511    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     512    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    513513
    514514    return mConsole->onDVDDriveChange();
     
    523523
    524524    AutoReadLock alock (this);
    525     AssertReturn (mState == SessionState_Open &&
    526                   mType == SessionType_Direct, E_FAIL);
     525    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     526    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    527527
    528528    return mConsole->onFloppyDriveChange();
     
    537537
    538538    AutoReadLock alock (this);
    539     AssertReturn (mState == SessionState_Open &&
    540                   mType == SessionType_Direct, E_FAIL);
     539    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     540    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    541541
    542542    return mConsole->onNetworkAdapterChange(networkAdapter);
     
    551551
    552552    AutoReadLock alock (this);
    553     AssertReturn (mState == SessionState_Open &&
    554                   mType == SessionType_Direct, E_FAIL);
     553    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     554    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    555555
    556556    return mConsole->onSerialPortChange(serialPort);
     
    565565
    566566    AutoReadLock alock (this);
    567     AssertReturn (mState == SessionState_Open &&
    568                   mType == SessionType_Direct, E_FAIL);
     567    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     568    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    569569
    570570    return mConsole->onParallelPortChange(parallelPort);
     
    579579
    580580    AutoReadLock alock (this);
    581     AssertReturn (mState == SessionState_Open &&
    582                   mType == SessionType_Direct, E_FAIL);
     581    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     582    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    583583
    584584    return mConsole->onVRDPServerChange();
     
    593593
    594594    AutoReadLock alock (this);
    595     AssertReturn (mState == SessionState_Open &&
    596                   mType == SessionType_Direct, E_FAIL);
     595    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     596    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    597597
    598598    return mConsole->onUSBControllerChange();
     
    607607
    608608    AutoReadLock alock (this);
    609     AssertReturn (mState == SessionState_Open &&
    610                   mType == SessionType_Direct, E_FAIL);
     609    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     610    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    611611
    612612    return mConsole->onSharedFolderChange (aGlobal);
     
    623623
    624624    AutoReadLock alock (this);
    625     AssertReturn (mState == SessionState_Open &&
    626                   mType == SessionType_Direct, E_FAIL);
     625    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     626    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    627627
    628628    return mConsole->onUSBDeviceAttach (aDevice, aError, aMaskedIfs);
     
    638638
    639639    AutoReadLock alock (this);
    640     AssertReturn (mState == SessionState_Open &&
    641                   mType == SessionType_Direct, E_FAIL);
     640    AssertReturn (mState == SessionState_Open, VBOX_E_INVALID_VM_STATE);
     641    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    642642
    643643    return mConsole->onUSBDeviceDetach (aId, aError);
     
    651651    AutoReadLock alock (this);
    652652
    653     AssertReturn (mType == SessionType_Direct, E_FAIL);
     653    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    654654
    655655    if (mState != SessionState_Open)
     
    678678            tr ("Machine session is not open (session state: %d)."),
    679679            mState);
    680     AssertReturn (mType == SessionType_Direct, E_UNEXPECTED);
     680    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    681681    CheckComArgNotNull(aName);
    682682    if (!aIsSetter && !VALID_PTR (aRetValue))
     
    712712
    713713    if (mState != SessionState_Open)
    714         return setError (E_FAIL,
     714        return setError (VBOX_E_INVALID_VM_STATE,
    715715            tr ("Machine session is not open (session state: %d)."),
    716716            mState);
    717     AssertReturn (mType == SessionType_Direct, E_UNEXPECTED);
     717    AssertReturn (mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
    718718    if (!VALID_PTR (aPatterns) && (aPatterns != NULL))
    719719        return E_POINTER;
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