VirtualBox

Changeset 23664 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 10, 2009 12:23:35 AM (15 years ago)
Author:
vboxsync
Message:

Main: stringify the machine state in error messages.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

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

    r23663 r23664  
    15111511        else
    15121512            return setError(VBOX_E_INVALID_VM_STATE,
    1513                 tr("Invalid machine state: %d (must be Running, Paused or Stuck)"),
    1514                 mMachineState);
     1513                tr("Invalid machine state: %s (must be Running, Paused or Stuck)"),
     1514                Global::stringifyMachineState(mMachineState));
    15151515    }
    15161516
     
    15621562    if (mMachineState != MachineState_Running)
    15631563        return setError(VBOX_E_INVALID_VM_STATE,
    1564             tr("Invalid machine state: %d"),
    1565             mMachineState);
     1564            tr("Invalid machine state: %s"),
     1565            Global::stringifyMachineState(mMachineState));
    15661566
    15671567    /* protect mpVM */
     
    15951595    if (mMachineState != MachineState_Running)
    15961596        return setError(VBOX_E_INVALID_VM_STATE,
    1597             tr("Invalid machine state: %d)"),
    1598             mMachineState);
     1597            tr("Invalid machine state: %s"),
     1598            Global::stringifyMachineState(mMachineState));
    15991599
    16001600    /* protect mpVM */
     
    16301630    if (mMachineState != MachineState_Paused)
    16311631        return setError(VBOX_E_INVALID_VM_STATE,
    1632             tr("Cannot resume the machine as it is not paused (machine state: %d)"),
    1633             mMachineState);
     1632            tr("Cannot resume the machine as it is not paused (machine state: %s)"),
     1633            Global::stringifyMachineState(mMachineState));
    16341634
    16351635    /* protect mpVM */
     
    16691669    if (mMachineState != MachineState_Running)
    16701670        return setError(VBOX_E_INVALID_VM_STATE,
    1671             tr("Invalid machine state: %d)"),
    1672             mMachineState);
     1671            tr("Invalid machine state: %s"),
     1672            Global::stringifyMachineState(mMachineState));
    16731673
    16741674    /* protect mpVM */
     
    17101710    if (mMachineState != MachineState_Running)
    17111711        return setError(VBOX_E_INVALID_VM_STATE,
    1712             tr("Invalid machine state: %d)"),
    1713             mMachineState);
     1712            tr("Invalid machine state: %s"),
     1713            Global::stringifyMachineState(mMachineState));
    17141714
    17151715    /* protect mpVM */
     
    17541754    if (mMachineState != MachineState_Running)
    17551755        return setError(VBOX_E_INVALID_VM_STATE,
    1756             tr("Invalid machine state %d when checking if the guest entered the ACPI mode)"),
    1757             mMachineState);
     1756            tr("Invalid machine state %s when checking if the guest entered the ACPI mode)"),
     1757            Global::stringifyMachineState(mMachineState));
    17581758
    17591759    /* protect mpVM */
     
    17891789    if (mMachineState != MachineState_Running)
    17901790        return setError(VBOX_E_INVALID_VM_STATE,
    1791             tr("Invalid machine state: %d)"),
    1792             mMachineState);
     1791            tr("Invalid machine state: %s)"),
     1792            Global::stringifyMachineState(mMachineState));
    17931793
    17941794    /* protect mpVM */
     
    18321832    {
    18331833        return setError(VBOX_E_INVALID_VM_STATE,
    1834             tr("Cannot save the execution state as the machine is not running or paused (machine state: %d)"),
    1835             mMachineState);
     1834            tr("Cannot save the execution state as the machine is not running or paused (machine state: %s)"),
     1835            Global::stringifyMachineState(mMachineState));
    18361836    }
    18371837
     
    19691969        mMachineState != MachineState_Aborted)
    19701970        return setError(VBOX_E_INVALID_VM_STATE,
    1971             tr("Cannot adopt the saved machine state as the machine is not in Powered Off or Aborted state (machine state: %d)"),
    1972             mMachineState);
     1971            tr("Cannot adopt the saved machine state as the machine is not in Powered Off or Aborted state (machine state: %s)"),
     1972            Global::stringifyMachineState(mMachineState));
    19731973
    19741974    return mControl->AdoptSavedState(aSavedStateFile);
     
    19841984    if (mMachineState != MachineState_Saved)
    19851985        return setError(VBOX_E_INVALID_VM_STATE,
    1986             tr("Cannot discard the machine state as the machine is not in the saved state (machine state: %d)"),
    1987             mMachineState);
     1986            tr("Cannot discard the machine state as the machine is not in the saved state (machine state: %s)"),
     1987            Global::stringifyMachineState(mMachineState));
    19881988
    19891989    HRESULT rc = S_OK;
     
    21082108        mMachineState != MachineState_Paused)
    21092109        return setError(VBOX_E_INVALID_VM_STATE,
    2110             tr("Cannot attach a USB device to the machine which is not running or paused (machine state: %d)"),
    2111             mMachineState);
     2110            tr("Cannot attach a USB device to the machine which is not running or paused (machine state: %s)"),
     2111            Global::stringifyMachineState(mMachineState));
    21122112
    21132113    /* protect mpVM */
     
    22862286    if (mMachineState > MachineState_Paused)
    22872287        return setError(VBOX_E_INVALID_VM_STATE,
    2288             tr("Cannot create a transient shared folder on the machine while it is changing the state (machine state: %d)"),
    2289             mMachineState);
     2288            tr("Cannot create a transient shared folder on the machine while it is changing the state (machine state: %s)"),
     2289            Global::stringifyMachineState(mMachineState));
    22902290
    22912291    ComObjPtr<SharedFolder> sharedFolder;
     
    23482348    if (mMachineState > MachineState_Paused)
    23492349        return setError(VBOX_E_INVALID_VM_STATE,
    2350             tr("Cannot remove a transient shared folder from the machine while it is changing the state (machine state: %d)"),
    2351             mMachineState);
     2350            tr("Cannot remove a transient shared folder from the machine while it is changing the state (machine state: %s)"),
     2351            Global::stringifyMachineState(mMachineState));
    23522352
    23532353    ComObjPtr<SharedFolder> sharedFolder;
     
    24062406    if (Global::IsTransient(mMachineState))
    24072407        return setError(VBOX_E_INVALID_VM_STATE,
    2408                         tr("Cannot take a snapshot of the machine while it is changing the state (machine state: %d)"),
    2409                         mMachineState);
     2408                        tr("Cannot take a snapshot of the machine while it is changing the state (machine state: %s)"),
     2409                        Global::stringifyMachineState(mMachineState));
    24102410
    24112411    HRESULT rc = S_OK;
     
    24182418    rc = mMachine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(aMediumAttachments));
    24192419    if (FAILED(rc))
    2420         return setError(VBOX_E_INVALID_VM_STATE,
    2421                         tr("Cannot get medium attachments of the machine"),
    2422                         mMachineState);
     2420        return setError(rc, tr("Cannot get medium attachments of the machine"));
    24232421
    24242422    ULONG ulMemSize;
     
    25302528    if (Global::IsOnlineOrTransient(mMachineState))
    25312529        return setError(VBOX_E_INVALID_VM_STATE,
    2532             tr("Cannot discard a snapshot of the running machine (machine state: %d)"),
    2533             mMachineState);
     2530            tr("Cannot discard a snapshot of the running machine (machine state: %s)"),
     2531            Global::stringifyMachineState(mMachineState));
    25342532
    25352533    MachineState_T machineState = MachineState_Null;
     
    25502548    if (Global::IsOnlineOrTransient(mMachineState))
    25512549        return setError(VBOX_E_INVALID_VM_STATE,
    2552             tr("Cannot discard the current state of the running machine (machine state: %d)"),
    2553             mMachineState);
     2550            tr("Cannot discard the current state of the running machine (machine state: %s)"),
     2551            Global::stringifyMachineState(mMachineState));
    25542552
    25552553    MachineState_T machineState = MachineState_Null;
     
    25702568    if (Global::IsOnlineOrTransient(mMachineState))
    25712569        return setError(VBOX_E_INVALID_VM_STATE,
    2572             tr("Cannot discard the current snapshot and state of the running machine (machine state: %d)"),
    2573             mMachineState);
     2570            tr("Cannot discard the current snapshot and state of the running machine (machine state: %s)"),
     2571            Global::stringifyMachineState(mMachineState));
    25742572
    25752573    MachineState_T machineState = MachineState_Null;
     
    45274525    if (Global::IsOnlineOrTransient(mMachineState))
    45284526        return setError(VBOX_E_INVALID_VM_STATE,
    4529             tr("Virtual machine is already running or busy (machine state: %d)"),
    4530             mMachineState);
     4527            tr("Virtual machine is already running or busy (machine state: %s)"),
     4528            Global::stringifyMachineState(mMachineState));
    45314529
    45324530    HRESULT rc = S_OK;
     
    47964794              mMachineState == MachineState_Restoring ||
    47974795              mMachineState == MachineState_Stopping,
    4798               ("Invalid machine state: %d\n", mMachineState));
     4796              ("Invalid machine state: %s\n", Global::stringifyMachineState(mMachineState)));
    47994797
    48004798    LogRel(("Console::powerDown(): A request to power off the VM has been issued (mMachineState=%d, InUninit=%d)\n",
  • trunk/src/VBox/Main/MachineImpl.cpp

    r23600 r23664  
    18881888       )
    18891889        return setError(VBOX_E_INVALID_VM_STATE,
    1890                         tr("The machine is not powered off (state is %d)"),
    1891                         mData->mMachineState);
     1890                        tr("The machine is not powered off (state is %s)"),
     1891                        Global::stringifyMachineState(mData->mMachineState));
    18921892
    18931893    mUserData.backup();
     
    20402040    if (Global::IsOnlineOrTransient(mData->mMachineState))
    20412041        return setError(VBOX_E_INVALID_VM_STATE,
    2042                         tr("Invalid machine state: %d"),
    2043                         mData->mMachineState);
     2042                        tr("Invalid machine state: %s"),
     2043                        Global::stringifyMachineState(mData->mMachineState));
    20442044
    20452045    /* Check for an existing controller. */
     
    24422442    if (Global::IsOnlineOrTransient(mData->mMachineState))
    24432443        return setError(VBOX_E_INVALID_VM_STATE,
    2444                         tr("Invalid machine state: %d"), mData->mMachineState);
     2444                        tr("Invalid machine state: %s"),
     2445                        Global::stringifyMachineState(mData->mMachineState));
    24452446
    24462447    MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,
     
    30333034        if (mData->mSession.mState != SessionState_Open)
    30343035            return setError(VBOX_E_INVALID_VM_STATE,
    3035                             tr("Machine session is not open (session state: %d)"),
    3036                             mData->mSession.mState);
     3036                            tr("Machine session is not open (session state: %s)"),
     3037                            Global::stringifyMachineState(mData->mSession.mState));
    30373038
    30383039        directControl = mData->mSession.mDirectControl;
     
    46284629                 mData->mMachineState == MachineState_Saved))
    46294630                return setError(VBOX_E_INVALID_VM_STATE,
    4630                                 tr("The machine is not mutable (state is %d)"),
    4631                                 mData->mMachineState);
     4631                                tr("The machine is not mutable (state is %s)"),
     4632                                Global::stringifyMachineState(mData->mMachineState));
    46324633            break;
    46334634        }
     
    46384639                 mData->mMachineState > MachineState_Paused))
    46394640                return setError(VBOX_E_INVALID_VM_STATE,
    4640                                 tr("The machine is not mutable (state is %d)"),
    4641                                 mData->mMachineState);
     4641                                tr("The machine is not mutable (state is %s)"),
     4642                                Global::stringifyMachineState(mData->mMachineState));
    46424643            break;
    46434644        }
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