VirtualBox

Changeset 8709

Show
Ignore:
Timestamp:
05/08/08 15:43:21 (2 months ago)
Author:
vboxsync
Message:

Added a setErrorNoLog method and aLogIt argument to the core setError methods (defaults to true) so that we can get rid of the disturbing release log errors caused by the USB drop down menu in the GUI.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/Main/Makefile.kmk

    r8699 r8709  
    4848 VBOX_MAIN_DEFS += VBOX_WITH_UNIXY_TAP_NETWORKING 
    4949endif 
    50 #if1of ($(KBUILD_TARGET), linux freebsd solaris) 
    51 # VBOX_MAIN_DEFS += VBOX_MAIN_USE_SEMRW 
    52 #else 
     50if1of ($(KBUILD_TARGET), linux freebsd solaris) 
     51 VBOX_MAIN_DEFS += VBOX_MAIN_USE_SEMRW 
     52else 
    5353 ifneq ($(VBOX_VERSION_MAJOR)$(VBOX_VERSION_MINOR)$(VBOX_VERSION_BUILD),160) 
    5454  VBOX_MAIN_DEFS += VBOX_MAIN_AUTOLOCK_TRAP 
    5555 endif 
    56 #endif 
     56endif 
    5757 
    5858## @todo eliminate or expand VBOX_MAIN_DEFS. 
  • trunk/src/VBox/Main/VirtualBoxBase.cpp

    r8683 r8709  
    609609    HRESULT aResultCode, const GUID &aIID, 
    610610    const Bstr &aComponent, const Bstr &aText, 
    611     bool aWarning
     611    bool aWarning, bool aLogIt
    612612{ 
    613613    /* whether multi-error mode is turned on */ 
    614614    bool preserve = ((uintptr_t) RTTlsGet (MultiResult::sCounter)) > 0; 
    615615 
    616     LogRel (("ERROR [COM]: aRC=%Rhrc (%#08x) aIID={%RTuuid} aComponent={%ls} aText={%ls} " 
    617              "aWarning=%RTbool, preserve=%RTbool\n", 
    618              aResultCode, aResultCode, &aIID, aComponent.raw(), aText.raw(), aWarning, 
    619              preserve)); 
     616    if (aLogIt) 
     617        LogRel (("ERROR [COM]: aRC=%Rhrc (%#08x) aIID={%RTuuid} aComponent={%ls} aText={%ls} " 
     618                 "aWarning=%RTbool, preserve=%RTbool\n", 
     619                 aResultCode, aResultCode, &aIID, aComponent.raw(), aText.raw(), aWarning, 
     620                 preserve)); 
    620621 
    621622    /* these are mandatory, others -- not */ 
  • trunk/src/VBox/Main/include/USBDeviceImpl.h

    r8701 r8709  
    130130        if (!found) 
    131131        { 
    132             return setError (E_INVALIDARG, OUSBDeviceCollection::tr ( 
     132            return setErrorNoLog (E_INVALIDARG, OUSBDeviceCollection::tr ( 
    133133                "Could not find a USB device with UUID {%s}"), 
    134134                idToFind.toString().raw()); 
     
    158158 
    159159        if (!found) 
    160             return setError (E_INVALIDARG, OUSBDeviceCollection::tr ( 
     160            return setErrorNoLog (E_INVALIDARG, OUSBDeviceCollection::tr ( 
    161161                "Could not find a USB device with address '%ls'"), 
    162162                aAddress); 
  • trunk/src/VBox/Main/include/VirtualBoxBase.h

    r8688 r8709  
    11051105    static HRESULT setErrorInternal (HRESULT aResultCode, const GUID &aIID, 
    11061106                                     const Bstr &aComponent, const Bstr &aText, 
    1107                                      bool aWarning); 
     1107                                     bool aWarning, bool aLogIt); 
    11081108 
    11091109protected: 
     
    12331233 
    12341234    static HRESULT setError (HRESULT aResultCode, const GUID &aIID, 
    1235                                     const Bstr &aComponent, 
    1236                                     const Bstr &aText) 
     1235                             const Bstr &aComponent, 
     1236                             const Bstr &aText, 
     1237                             bool aLogIt = true) 
    12371238    { 
    12381239        return setErrorInternal (aResultCode, aIID, aComponent, aText, 
    1239                                  false /* aWarning */); 
     1240                                 false /* aWarning */, aLogIt); 
    12401241    } 
    12411242 
     
    12451246    { 
    12461247        return setErrorInternal (aResultCode, aIID, aComponent, aText, 
    1247                                  true /* aWarning */); 
     1248                                 true /* aWarning */, true /* aLogIt */); 
    12481249    } 
    12491250 
    12501251    static HRESULT setError (HRESULT aResultCode, const GUID &aIID, 
    12511252                             const Bstr &aComponent, 
    1252                              const char *aText, va_list aArgs
     1253                             const char *aText, va_list aArgs, bool aLogIt = true
    12531254    { 
    12541255        return setErrorInternal (aResultCode, aIID, aComponent, 
    12551256                                 Utf8StrFmtVA (aText, aArgs), 
    1256                                  false /* aWarning */); 
     1257                                 false /* aWarning */, aLogIt); 
    12571258    } 
    12581259 
     
    12631264        return setErrorInternal (aResultCode, aIID, aComponent, 
    12641265                                 Utf8StrFmtVA (aText, aArgs), 
    1265                                  true /* aWarning */); 
     1266                                 true /* aWarning */, true /* aLogIt */); 
    12661267    } 
    12671268}; 
     
    13821383        va_start (args, aText); 
    13831384        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError 
    1384             (aResultCode, aIID, aComponent, aText, args); 
     1385            (aResultCode, aIID, aComponent, aText, args, true /* aLogIt */); 
    13851386        va_end (args); 
    13861387        return rc; 
     
    14361437        va_start (args, aText); 
    14371438        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError 
    1438             (aResultCode, COM_IIDOF(I), C::getComponentName(), aText, args); 
     1439            (aResultCode, COM_IIDOF(I), C::getComponentName(), aText, args, true /* aLogIt */); 
    14391440        va_end (args); 
    14401441        return rc; 
     
    14731474    { 
    14741475        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError 
    1475             (aResultCode, COM_IIDOF(I), C::getComponentName(), aText, aArgs); 
     1476            (aResultCode, COM_IIDOF(I), C::getComponentName(), aText, aArgs, true /* aLogIt */); 
    14761477        return rc; 
    14771478    } 
     
    15091510    { 
    15101511        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError 
    1511             (aResultCode, COM_IIDOF(I), C::getComponentName(), aText); 
     1512            (aResultCode, COM_IIDOF(I), C::getComponentName(), aText, true /* aLogIt */); 
    15121513        return rc; 
    15131514    } 
     
    15441545        va_start (args, aText); 
    15451546        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError 
    1546             (aResultCode, aIID, C::getComponentName(), aText, args); 
     1547            (aResultCode, aIID, C::getComponentName(), aText, args, true /* aLogIt */); 
    15471548        va_end (args); 
    15481549        return rc; 
     
    15651566        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setWarning 
    15661567            (aResultCode, aIID, C::getComponentName(), aText, args); 
     1568        va_end (args); 
     1569        return rc; 
     1570    } 
     1571 
     1572    /** 
     1573     *  Sets the error information for the current thread but doesn't put 
     1574     *  anything in the release log. This is very useful for avoiding 
     1575     *  harmless error from causing confusion. 
     1576     * 
     1577     *  It is otherwise identical to #setError (HRESULT, const char *text, ...). 
     1578     */ 
     1579    static HRESULT setErrorNoLog (HRESULT aResultCode, const char *aText, ...) 
     1580    { 
     1581        va_list args; 
     1582        va_start (args, aText); 
     1583        HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError 
     1584            (aResultCode, COM_IIDOF(I), C::getComponentName(), aText, args, false /* aLogIt */); 
    15671585        va_end (args); 
    15681586        return rc; 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy