VirtualBox

Changeset 15050 in vbox for trunk


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
Location:
trunk/src/VBox/Main
Files:
2 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);
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r15044 r15050  
    35703570
    35713571        @todo setHardDiskBootOrder(), setNetworkBootOrder()
     3572
     3573        <result name="E_INVALIDARG">
     3574          Boot @a position out of range.
     3575        </result>
     3576        <result name="E_NOTIMPL">
     3577          Booting from USB @a device currently not supported.
     3578        </result>
     3579
    35723580      </desc>
    35733581      <param name="position" type="unsigned long" dir="in">
     
    35993607
    36003608        @todo getHardDiskBootOrder(), getNetworkBootOrder()
    3601       </desc>
    3602       <param name="order" type="unsigned long" dir="in">
     3609
     3610        <result name="E_INVALIDARG">
     3611          Boot @a position out of range.
     3612        </result>
     3613
     3614      </desc>
     3615      <param name="position" type="unsigned long" dir="in">
    36033616        <desc>
    36043617          Position in the boot order (<tt>1</tt> to the total number of
     
    36163629    <method name="attachHardDisk2">
    36173630      <desc>
    3618         Attaches a virtual hard disk identified by the given UUID to a device
    3619         slot of the specified bus.
     3631        Attaches a virtual hard disk identified by the given UUID @a id
     3632        to a device slot of the specified bus.
    36203633
    36213634        For the IDE bus, the @a channel parameter can be either @c 0 or @c 1, to
    36223635        specify the primary or secondary IDE controller, respectively. The
    3623         SATA bus supports 30 channels, so this parameter can be a number in
    3624         range from @c 0 to @c 29.
     3636        SATA bus supports 30 channels, so this parameter can be a number
     3637        ranging from @c 0 to @c 29.
    36253638
    36263639        For the primary controller of the IDE bus, the @a device number can be
     
    36293642        always @c 1 because the master device is reserved for the CD-ROM drive.
    36303643
    3631         For the SATA bus, the @a device parameter is not currently used and
    3632         must always be @c 0.
     3644        For the SATA bus, the @a device parameter is currently unused and
     3645        must be @c 0.
    36333646
    36343647        The specified device slot must not have another disk attached to it, or
     
    36453658        <note>
    36463659          If the hard disk is being attached indirectly, a new differencing hard
    3647           disk will be implicitly created for it and attached instead. If the
     3660          disk will implicitly be created for it and attached instead. If the
    36483661          changes made to the machine settings (including this indirect
    36493662          attachment) are later cancelled using <link to="#discardSettings()"/>,
    3650           this implicitly created differencing hard disk will be implicitly
    3651           deleted.
    3652         </note>
     3663          this implicitly created differencing hard disk will implicitly
     3664          be deleted.
     3665        </note>
     3666
     3667        <result name="E_INVALIDARG">
     3668          SATA device, SATA channel, IDE channel or IDE slot out of range.
     3669        </result>
     3670        <result name="VBOX_E_INVALID_OBJECT_STATE">
     3671          Attempt to attach hard disk to an unregistered virtual machine.
     3672        </result>
     3673        <result name="VBOX_E_INVALID_VM_STATE">
     3674          Invalid machine state.
     3675        </result>
     3676        <result name="VBOX_E_OBJECT_IN_USE">
     3677          Hard disk already attached to this or another virtual machine.
     3678        </result>
     3679
    36533680      </desc>
    36543681      <param name="id" type="uuid" dir="in">
     
    36783705        <link to="#attachHardDisk2()"/> call. See <link to="IHardDisk2"/> for
    36793706        more detailed information about attaching hard disks.
     3707
     3708        <result name="VBOX_E_OBJECT_NOT_FOUND">
     3709          No hard disk attached to given slot/bus.
     3710        </result>
     3711
    36803712      </desc>
    36813713      <param name="bus" type="StorageBus" dir="in">
     
    37163748          <link to="#saveSettings()"/>, if it is the desired action.
    37173749        </note>
     3750
     3751        <result name="VBOX_E_INVALID_VM_STATE">
     3752          Attempt to detach hard disk from a running virtual machine.
     3753        </result>
     3754        <result name="VBOX_E_OBJECT_NOT_FOUND">
     3755          No hard disk attached to given slot/bus.
     3756        </result>
     3757        <result name="VBOX_E_NOT_SUPPORTED">
     3758          Hard disk format does not support storage deletion.
     3759        </result>
    37183760
    37193761      </desc>
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