VirtualBox

Changeset 38509 in vbox for trunk/include


Ignore:
Timestamp:
Aug 23, 2011 3:07:55 PM (13 years ago)
Author:
vboxsync
Message:

Main/glue/ErrorInfo: print _all_ error messages, not only the last one; add glue code for printing errors from a IProgress object

File:
1 edited

Legend:

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

    r36536 r38509  
    3636// shared prototypes; these are defined in shared glue code and are
    3737// compiled only once for all front-ends
    38 void GluePrintErrorInfo(com::ErrorInfo &info);
     38void GluePrintErrorInfo(const com::ErrorInfo &info);
    3939void GluePrintErrorContext(const char *pcszContext, const char *pcszSourceFile, uint32_t ulLine);
    4040void GluePrintRCMessage(HRESULT rc);
    41 void GlueHandleComError(ComPtr<IUnknown> iface, const char *pcszContext, HRESULT rc, const char *pcszSourceFile, uint32_t ulLine);
     41void GlueHandleComError(ComPtr<IUnknown> iface,
     42                        const char *pcszContext,
     43                        HRESULT rc,
     44                        const char *pcszSourceFile,
     45                        uint32_t ulLine);
     46void GlueHandleComErrorProgress(ComPtr<IProgress> progress,
     47                                const char *pcszContext,
     48                                HRESULT rc,
     49                                const char *pcszSourceFile,
     50                                uint32_t ulLine);
    4251
    4352/**
     
    153162    } while (0)
    154163
     164
     165/**
     166 * Check the progress object for an error and if there is one print out the
     167 * extended error information.
     168 */
     169#define CHECK_PROGRESS_ERROR(progress) \
     170    do { \
     171        LONG iRc; \
     172        rc = progress->COMGETTER(ResultCode)(&iRc); \
     173        if (FAILED(iRc)) \
     174            com::GlueHandleComErrorProgress(progress, __PRETTY_FUNCTION__, iRc, __FILE__, __LINE__); \
     175    } while (0)
     176
     177/**
     178 *  Does the same as CHECK_PROGRESS_ERROR(), but executes the |return ret| statement on
     179 *  failure.
     180 */
     181#define CHECK_PROGRESS_ERROR_RET(progress, ret) \
     182    do { \
     183        LONG iRc; \
     184        rc = progress->COMGETTER(ResultCode)(&iRc); \
     185        if (FAILED(iRc)) \
     186        { \
     187            com::GlueHandleComErrorProgress(progress, __PRETTY_FUNCTION__, iRc, __FILE__, __LINE__); \
     188            return (ret); \
     189        } \
     190    } while (0)
     191
    155192/**
    156193 *  Asserts the given expression is true. When the expression is false, prints
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