Changeset 89720 in vbox for trunk/src/VBox/Main/glue
- Timestamp:
- Jun 15, 2021 6:53:58 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/errorprint.cpp
r86141 r89720 47 47 try 48 48 { 49 HRESULT rc = S_OK; 49 50 Utf8Str str; 50 51 RTCList<Utf8Str> comp; … … 55 56 bstrDetailsText.raw()); 56 57 if (haveResultCode) 57 comp.append(Utf8StrFmt("code %Rhrc (0x%RX32)", 58 info.getResultCode(), 59 info.getResultCode())); 58 { 59 rc = info.getResultCode(); 60 comp.append(Utf8StrFmt("code %Rhrc (0x%RX32)", rc, rc)); 61 } 60 62 if (haveComponent) 61 63 comp.append(Utf8StrFmt("component %ls", … … 78 80 79 81 // print and log 80 RTMsgError("%s", str.c_str()); 81 Log(("ERROR: %s", str.c_str())); 82 if (FAILED(rc)) 83 { 84 RTMsgError("%s", str.c_str()); 85 Log(("ERROR: %s", str.c_str())); 86 } 87 else 88 { 89 RTMsgWarning("%s", str.c_str()); 90 Log(("WARNING: %s", str.c_str())); 91 } 82 92 } 83 93 catch (std::bad_alloc &) … … 88 98 } 89 99 90 void GluePrintErrorContext(const char *pcszContext, const char *pcszSourceFile, uint32_t ulLine )100 void GluePrintErrorContext(const char *pcszContext, const char *pcszSourceFile, uint32_t ulLine, bool fWarning /* = false */) 91 101 { 92 102 // pcszSourceFile comes from __FILE__ macro, which always contains the full path, … … 94 104 // print and log 95 105 const char *pszFilenameOnly = RTPathFilename(pcszSourceFile); 96 RTMsgError("Context: \"%s\" at line %d of file %s\n", pcszContext, ulLine, pszFilenameOnly); 97 Log(("Context: \"%s\" at line %d of file %s\n", pcszContext, ulLine, pszFilenameOnly)); 106 if (!fWarning) 107 { 108 RTMsgError("Context: \"%s\" at line %d of file %s\n", pcszContext, ulLine, pszFilenameOnly); 109 Log(("ERROR: Context: \"%s\" at line %d of file %s\n", pcszContext, ulLine, pszFilenameOnly)); 110 } 111 else 112 { 113 RTMsgWarning("Context: \"%s\" at line %d of file %s\n", pcszContext, ulLine, pszFilenameOnly); 114 Log(("WARNING: Context: \"%s\" at line %d of file %s\n", pcszContext, ulLine, pszFilenameOnly)); 115 } 98 116 } 99 117 … … 101 119 { 102 120 // print and log 103 RTMsgError("Code %Rhra (extended info not available)\n", rc); 104 Log(("ERROR: Code %Rhra (extended info not available)\n", rc)); 121 if (FAILED(rc)) 122 { 123 RTMsgError("Code %Rhra (extended info not available)\n", rc); 124 Log(("ERROR: Code %Rhra (extended info not available)\n", rc)); 125 } 126 else 127 { 128 RTMsgWarning("Code %Rhra (extended info not available)\n", rc); 129 Log(("WARNING: Code %Rhra (extended info not available)\n", rc)); 130 } 105 131 } 106 132 … … 117 143 { 118 144 GluePrintErrorInfo(*pInfo); 145 146 /* Use rc for figuring out if there were just warnings. */ 147 HRESULT rc2 = pInfo->getResultCode(); 148 if ( (SUCCEEDED_WARNING(rc) && FAILED(rc2)) 149 || (SUCCEEDED(rc) && (FAILED(rc2) || SUCCEEDED_WARNING(rc2)))) 150 rc = rc2; 119 151 120 152 pInfo = pInfo->getNext(); … … 136 168 137 169 if (pcszContext != NULL || pcszSourceFile != NULL) 138 GluePrintErrorContext(pcszContext, pcszSourceFile, ulLine );170 GluePrintErrorContext(pcszContext, pcszSourceFile, ulLine, SUCCEEDED_WARNING(rc)); 139 171 } 140 172
Note:
See TracChangeset
for help on using the changeset viewer.