VirtualBox

Changeset 45805 in vbox


Ignore:
Timestamp:
Apr 29, 2013 12:30:50 PM (12 years ago)
Author:
vboxsync
Message:

Main: Removed IGuestErrorInfo, added new attribute resultDetail to IVirtualBoxErrorInfo for (optionally) providing more details on the error happened.

Location:
trunk
Files:
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/ErrorInfo.h

    r45125 r45805  
    174174          mIsFullAvailable(false),
    175175          mResultCode(S_OK),
     176          mResultDetail(0),
    176177          m_pNext(NULL)
    177178    {
     
    183184          mIsFullAvailable(false),
    184185          mResultCode(S_OK),
     186          mResultDetail(0),
    185187          m_pNext(NULL)
    186188    {
     
    191193    ErrorInfo (const ComPtr <IVirtualBoxErrorInfo> &aPtr)
    192194        : mIsBasicAvailable (false), mIsFullAvailable (false)
    193         , mResultCode (S_OK)
     195        , mResultCode (S_OK), mResultDetail(0)
    194196        { init (aPtr); }
    195197
     
    204206    ErrorInfo (IVirtualBoxErrorInfo *aInfo)
    205207        : mIsBasicAvailable (false), mIsFullAvailable (false)
    206         , mResultCode (S_OK)
     208        , mResultCode (S_OK), mResultDetail(0)
    207209        { init (aInfo); }
    208210
     
    264266    {
    265267        return mResultCode;
     268    }
     269
     270    /**
     271     *  Returns the (optional) result detail code of the failed operation.
     272     */
     273    LONG getResultDetail() const
     274    {
     275        return mResultDetail;
    266276    }
    267277
     
    359369
    360370    HRESULT mResultCode;
     371    LONG    mResultDetail;
    361372    Guid    mInterfaceID;
    362373    Bstr    mComponent;
  • trunk/src/VBox/Main/Makefile.kmk

    r45731 r45805  
    641641        src-client/GuestImpl.cpp \
    642642        src-client/GuestDirectoryImpl.cpp \
    643         src-client/GuestErrorInfoImpl.cpp \
    644643        src-client/GuestFileImpl.cpp \
    645644        src-client/GuestFsObjInfoImpl.cpp \
  • trunk/src/VBox/Main/glue/ErrorInfo.cpp

    r44970 r45805  
    5050
    5151    mResultCode = x.mResultCode;
     52    mResultDetail = x.mResultDetail;
    5253    mInterfaceID = x.mInterfaceID;
    5354    mComponent = x.mComponent;
     
    7879
    7980    mResultCode = S_OK;
     81    mResultDetail = 0;
    8082    mInterfaceID.clear();
    8183    mComponent.setNull();
     
    225227    bool gotSomething = false;
    226228    bool gotAll = true;
    227     LONG lrc;
     229    LONG lrc, lrd;
    228230
    229231    rc = info->COMGETTER(ResultCode)(&lrc); mResultCode = lrc;
     232    gotSomething |= SUCCEEDED(rc);
     233    gotAll &= SUCCEEDED(rc);
     234
     235    rc = info->COMGETTER(ResultDetail)(&lrd); mResultDetail = lrd;
    230236    gotSomething |= SUCCEEDED(rc);
    231237    gotAll &= SUCCEEDED(rc);
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r45680 r45805  
    12611261  <interface
    12621262    name="IVirtualBoxErrorInfo" extends="$errorinfo"
    1263     uuid="f91e6e91-49e1-4fd2-b21e-269003350d06"
     1263    uuid="c1bcc6d5-7966-481d-ab0b-d0ed73e28135"
    12641264    supportsErrorInfo="no"
    12651265    wsmap="managed"
     
    13081308          In XPCOM, it is the same as nsIException::result.
    13091309        </note>
     1310      </desc>
     1311    </attribute>
     1312
     1313    <attribute name="resultDetail" type="long" readonly="yes">
     1314      <desc>
     1315        Optional result data of this error. This will vary depending on the
     1316        actual error usage. By default this attribute is not being used.
    13101317      </desc>
    13111318    </attribute>
     
    97249731
    97259732  <interface
    9726     name="IGuestErrorInfo" extends="$unknown"
    9727     uuid="ab576a37-dcfc-4d80-9a73-493d15e293c4"
    9728     wsmap="managed"
    9729     >
    9730     <desc>
    9731       The IGuestErrorInfo interface represents extended error information which
    9732       happened while performing an operation on the guest.
    9733     </desc>
    9734 
    9735     <attribute name="result" type="long" readonly="yes">
    9736       <desc>Runtime (IPRT) error code. See include/iprt/err.h and include/VBox/err.h
    9737         for details.</desc>
    9738     </attribute>
    9739 
    9740     <attribute name="text" type="wstring" readonly="yes">
    9741       <desc>Text description of the error.</desc>
    9742     </attribute>
    9743 
    9744   </interface>
    9745 
    9746   <interface
    97479733    name="IGuestSession" extends="$unknown"
    97489734    uuid="c8e8607b-5e67-4073-8f14-146515d0c1ff"
     
    1997719963      </desc>
    1997819964    </attribute>
    19979     <attribute name="error" type="IGuestErrorInfo" readonly="yes">
    19980       <desc>
    19981         Extended guest error information in case of new session
    19982         status is indicating an error.
     19965    <attribute name="error" type="IVirtualBoxErrorInfo" readonly="yes">
     19966      <desc>
     19967        Error information in case of new session status is indicating an error.
     19968
     19969        The attribute <link to="IVirtualBoxErrorInfo::resultDetail"/> will contain
     19970        the runtime (IPRT) error code from the guest. See include/iprt/err.h and
     19971        include/VBox/err.h for details.
    1998319972      </desc>
    1998419973    </attribute>
     
    2005620045      </desc>
    2005720046    </attribute>
    20058     <attribute name="error" type="IGuestErrorInfo" readonly="yes">
    20059       <desc>
    20060         Extended guest error information in case of new process
    20061         status is indicating an error.
     20047    <attribute name="error" type="IVirtualBoxErrorInfo" readonly="yes">
     20048      <desc>
     20049        Error information in case of new session status is indicating an error.
     20050
     20051        The attribute <link to="IVirtualBoxErrorInfo::resultDetail"/> will contain
     20052        the runtime (IPRT) error code from the guest. See include/iprt/err.h and
     20053        include/VBox/err.h for details.
    2006220054      </desc>
    2006320055    </attribute>
     
    2017120163      </desc>
    2017220164    </attribute>
    20173     <attribute name="error" type="IGuestErrorInfo" readonly="yes">
    20174       <desc>
    20175         Extended guest error information in case of new file
    20176         status is indicating an error.
     20165    <attribute name="error" type="IVirtualBoxErrorInfo" readonly="yes">
     20166      <desc>
     20167        Error information in case of new session status is indicating an error.
     20168
     20169        The attribute <link to="IVirtualBoxErrorInfo::resultDetail"/> will contain
     20170        the runtime (IPRT) error code from the guest. See include/iprt/err.h and
     20171        include/VBox/err.h for details.
    2017720172      </desc>
    2017820173    </attribute>
  • trunk/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h

    r44528 r45805  
    9494                 IVirtualBoxErrorInfo *aNext = NULL);
    9595
     96    HRESULT initEx(HRESULT aResultCode,
     97                   LONG aResultDetail,
     98                   const GUID &aIID,
     99                   const char *pcszComponent,
     100                   const Utf8Str &strText,
     101                   IVirtualBoxErrorInfo *aNext = NULL);
     102
    96103    HRESULT init(const com::ErrorInfo &ei,
    97104                 IVirtualBoxErrorInfo *aNext = NULL);
     
    99106    // IVirtualBoxErrorInfo properties
    100107    STDMETHOD(COMGETTER(ResultCode))(LONG *aResultCode);
     108    STDMETHOD(COMGETTER(ResultDetail))(LONG *aResultDetail);
    101109    STDMETHOD(COMGETTER(InterfaceID))(BSTR *aIID);
    102110    STDMETHOD(COMGETTER(Component))(BSTR *aComponent);
     
    114122
    115123    HRESULT m_resultCode;
     124    LONG    m_resultDetail;
    116125    Utf8Str m_strText;
    117126    Guid    m_IID;
  • trunk/src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp

    r42261 r45805  
    3131{
    3232    m_resultCode = aResultCode;
     33    m_resultDetail = 0; /* Not being used. */
    3334    m_IID = aIID;
    3435    m_strComponent = pcszComponent;
     
    3940}
    4041
     42HRESULT VirtualBoxErrorInfo::initEx(HRESULT aResultCode,
     43                                    LONG aResultDetail,
     44                                    const GUID &aIID,
     45                                    const char *pcszComponent,
     46                                    const Utf8Str &strText,
     47                                    IVirtualBoxErrorInfo *aNext)
     48{
     49    HRESULT hr = init(aResultCode, aIID, pcszComponent, strText, aNext);
     50    m_resultDetail = aResultDetail;
     51
     52    return hr;
     53}
     54
    4155HRESULT VirtualBoxErrorInfo::init(const com::ErrorInfo &info,
    4256                                  IVirtualBoxErrorInfo *aNext)
    4357{
    4458    m_resultCode = info.getResultCode();
     59    m_resultDetail = info.getResultDetail();
    4560    m_IID = info.getInterfaceID();
    4661    m_strComponent = info.getComponent();
     
    7590}
    7691
     92STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(ResultDetail)(LONG *aResultDetail)
     93{
     94    CheckComArgOutPointerValid(aResultDetail);
     95
     96    *aResultDetail = m_resultDetail;
     97    return S_OK;
     98}
     99
    77100STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(InterfaceID)(BSTR *aIID)
    78101{
     
    124147
    125148    m_resultCode = S_OK;
     149    m_resultDetail = 0;
    126150    rc = aInfo->GetGUID(m_IID.asOutParam());
    127151    AssertComRC(rc);
     
    188212    rc = aInfo->GetResult(&m_resultCode);
    189213    AssertComRC(rc);
     214    m_resultDetail = 0; /* Not being used. */
    190215
    191216    char *pszMsg;             /* No Utf8Str.asOutParam, different allocator! */
  • trunk/src/VBox/Main/src-client/GuestFileImpl.cpp

    r45780 r45805  
    2121*   Header Files                                                               *
    2222*******************************************************************************/
    23 #include "GuestErrorInfoImpl.h"
    2423#include "GuestFileImpl.h"
    2524#include "GuestSessionImpl.h"
    2625#include "GuestCtrlImplPrivate.h"
    2726#include "ConsoleImpl.h"
     27#include "VirtualBoxErrorInfoImpl.h"
    2828
    2929#include "Global.h"
     
    919919        mData.mStatus = fileStatus;
    920920
    921         ComObjPtr<GuestErrorInfo> errorInfo;
     921        ComObjPtr<VirtualBoxErrorInfo> errorInfo;
    922922        HRESULT hr = errorInfo.createObject();
    923923        ComAssertComRC(hr);
    924924        if (RT_FAILURE(fileRc))
    925925        {
    926             int rc2 = errorInfo->init(fileRc, guestErrorToString(fileRc));
     926            int rc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, fileRc,
     927                                        COM_IIDOF(IGuestFile), getComponentName(),
     928                                        guestErrorToString(fileRc));
    927929            AssertRC(rc2);
    928930        }
  • trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp

    r45780 r45805  
    2929*   Header Files                                                               *
    3030*******************************************************************************/
    31 #include "GuestErrorInfoImpl.h"
    3231#include "GuestProcessImpl.h"
    3332#include "GuestSessionImpl.h"
    3433#include "GuestCtrlImplPrivate.h"
    3534#include "ConsoleImpl.h"
    36 #include "VBoxEvents.h"
     35#include "VirtualBoxErrorInfoImpl.h"
    3736
    3837#include "Global.h"
    3938#include "AutoCaller.h"
     39#include "VBoxEvents.h"
    4040
    4141#include <memory> /* For auto_ptr. */
     
    938938        mData.mRC     = procRc;
    939939
    940         ComObjPtr<GuestErrorInfo> errorInfo;
     940        ComObjPtr<VirtualBoxErrorInfo> errorInfo;
    941941        HRESULT hr = errorInfo.createObject();
    942942        ComAssertComRC(hr);
    943943        if (RT_FAILURE(mData.mRC))
    944944        {
    945             int rc2 = errorInfo->init(mData.mRC, guestErrorToString(mData.mRC));
     945            int rc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, mData.mRC,
     946                                        COM_IIDOF(IGuestProcess), getComponentName(),
     947                                        guestErrorToString(mData.mRC));
    946948            AssertRC(rc2);
    947949        }
     
    15261528        }
    15271529
    1528         ComPtr<IGuestErrorInfo> errorInfo;
     1530        ComPtr<IVirtualBoxErrorInfo> errorInfo;
    15291531        hr = pProcessEvent->COMGETTER(Error)(errorInfo.asOutParam());
    15301532        ComAssertComRC(hr);
    15311533
    15321534        LONG lGuestRc;
    1533         hr = errorInfo->COMGETTER(Result)(&lGuestRc);
     1535        hr = errorInfo->COMGETTER(ResultDetail)(&lGuestRc);
    15341536        ComAssertComRC(hr);
    15351537        if (RT_FAILURE((int)lGuestRc))
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r45783 r45805  
    2222*******************************************************************************/
    2323#include "GuestImpl.h"
    24 #include "GuestErrorInfoImpl.h"
    2524#include "GuestSessionImpl.h"
    2625#include "GuestCtrlImplPrivate.h"
     26#include "VirtualBoxErrorInfoImpl.h"
    2727
    2828#include "Global.h"
     
    17021702        mData.mRC     = sessionRc;
    17031703
    1704         ComObjPtr<GuestErrorInfo> errorInfo;
     1704        ComObjPtr<VirtualBoxErrorInfo> errorInfo;
    17051705        HRESULT hr = errorInfo.createObject();
    17061706        ComAssertComRC(hr);
    1707         int rc2 = errorInfo->init(sessionRc, guestErrorToString(sessionRc));
     1707        int rc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, sessionRc,
     1708                                    COM_IIDOF(IGuestSession), getComponentName(),
     1709                                    guestErrorToString(sessionRc));
    17081710        AssertRC(rc2);
    17091711
     
    19811983            *pSessionStatus = sessionStatus;
    19821984
    1983         ComPtr<IGuestErrorInfo> errorInfo;
     1985        ComPtr<IVirtualBoxErrorInfo> errorInfo;
    19841986        HRESULT hr = pChangedEvent->COMGETTER(Error)(errorInfo.asOutParam());
    19851987        ComAssertComRC(hr);
    19861988
    19871989        LONG lGuestRc;
    1988         hr = errorInfo->COMGETTER(Result)(&lGuestRc);
     1990        hr = errorInfo->COMGETTER(ResultDetail)(&lGuestRc);
    19891991        ComAssertComRC(hr);
    19901992        if (RT_FAILURE((int)lGuestRc))
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