VirtualBox

Ignore:
Timestamp:
Dec 5, 2008 3:38:31 PM (16 years ago)
Author:
vboxsync
Message:

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

  • IMachine::setBootOrder
  • IMachine::getBootOrder
  • IMachine::attachHardDisk2
  • IMachine::getHardDisk2
  • IMachine::detachHardDisk2
File:
1 edited

Legend:

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

    r15039 r15050  
    18081808
    18091809    if (aDevice == DeviceType_USB)
    1810         return setError (E_FAIL,
    1811             tr ("Booting from USB devices is not currently supported"));
     1810        return setError (E_NOTIMPL,
     1811            tr ("Booting from USB device is currently not supported"));
    18121812
    18131813    AutoCaller autoCaller (this);
     
    18651865    {
    18661866        if (aChannel < 0 || aChannel > 1)
    1867             return setError (E_FAIL,
     1867            return setError (E_INVALIDARG,
    18681868                tr ("Invalid IDE channel: %l (must be in range [0, 1])"),
    18691869                aChannel);
     
    18721872        {
    18731873            if (aDevice < 0 || aDevice > 1)
    1874                 return setError (E_FAIL,
     1874                return setError (E_INVALIDARG,
    18751875                    tr ("Invalid IDE device slot: %l (must be in range "
    18761876                        "[0, 1] for channel 0)"),
     
    18821882            /* Device slot 0 is reserved for the CD/DVD drive. */
    18831883            if (aDevice != 1)
    1884                 return setError (E_FAIL,
     1884                return setError (E_INVALIDARG,
    18851885                    tr ("Invalid IDE device slot: %l (must be "
    18861886                        "1 for channel 1)"),
     
    19041904    /// @todo NEWMEDIA implicit machine registration
    19051905    if (!mData->mRegistered)
    1906         return setError (E_FAIL,
     1906        return setError (VBOX_E_INVALID_OBJECT_STATE,
    19071907            tr ("Cannot attach hard disks to an unregistered machine"));
    19081908
     
    19101910
    19111911    if (mData->mMachineState >= MachineState_Running)
    1912         return setError (E_FAIL,
     1912        return setError (VBOX_E_INVALID_VM_STATE,
    19131913            tr ("Invalid machine state: %d"), mData->mMachineState);
    19141914
     
    19231923        ComObjPtr <HardDisk2> hd = (*it)->hardDisk();
    19241924        AutoReadLock hdLock (hd);
    1925         return setError (E_FAIL,
     1925        return setError (VBOX_E_OBJECT_IN_USE,
    19261926            tr ("Hard disk '%ls' is already attached to device slot %d on "
    19271927                "channel %d of bus %d of this virtual machine"),
     
    19461946            mHDData->mAttachments.end())
    19471947    {
    1948         return setError (E_FAIL,
     1948        return setError (VBOX_E_OBJECT_IN_USE,
    19491949            tr ("Hard disk '%ls' is already attached to this virtual machine"),
    19501950            hd->locationFull().raw());
     
    21892189                                    LONG aDevice, IHardDisk2 **aHardDisk)
    21902190{
    2191     if (aBus == StorageBus_Null)
    2192         return E_INVALIDARG;
     2191    CheckComArgExpr(aBus, aBus != StorageBus_Null);
     2192    CheckComArgOutPointerValid(aHardDisk);
    21932193
    21942194    AutoCaller autoCaller (this);
     
    22052205
    22062206    if (it == mHDData->mAttachments.end())
    2207         return setError (E_INVALIDARG,
     2207        return setError (VBOX_E_OBJECT_NOT_FOUND,
    22082208            tr ("No hard disk attached to device slot %d on channel %d of bus %d"),
    22092209            aDevice, aChannel, aBus);
     
    22172217                                       LONG aDevice)
    22182218{
    2219     if (aBus == StorageBus_Null)
    2220         return E_INVALIDARG;
     2219    CheckComArgExpr(aBus, aBus != StorageBus_Null);
    22212220
    22222221    AutoCaller autoCaller (this);
     
    22312230
    22322231    if (mData->mMachineState >= MachineState_Running)
    2233         return setError (E_FAIL,
     2232        return setError (VBOX_E_INVALID_VM_STATE,
    22342233            tr ("Invalid machine state: %d"), mData->mMachineState);
    22352234
     
    22402239
    22412240    if (it == mHDData->mAttachments.end())
    2242         return setError (E_INVALIDARG,
     2241        return setError (VBOX_E_OBJECT_NOT_FOUND,
    22432242            tr ("No hard disk attached to device slot %d on channel %d of bus %d"),
    22442243            aDevice, aChannel, aBus);
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