Changeset 79138 in vbox for trunk/src/VBox/ValidationKit/testdriver/vbox.py
- Timestamp:
- Jun 14, 2019 1:00:00 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vbox.py
r79092 r79138 182 182 return reporter.error(stringifyErrorInfo(oErrObj)); 183 183 184 def formatComOrXpComException(oType, oXcpt): 185 """ 186 Callback installed with the reporter to better format COM exceptions. 187 Similar to format_exception_only, only it returns None if not interested. 188 """ 189 _ = oType; 190 oVBoxMgr = vboxcon.goHackModuleClass.oVBoxMgr; 191 if oVBoxMgr is None: 192 return None; 193 if not oVBoxMgr.xcptIsOurXcptKind(oXcpt): # pylint: disable=not-callable 194 return None; 195 196 if platform.system() == 'Windows': 197 hrc = oXcpt.hresult; 198 if hrc == ComError.DISP_E_EXCEPTION and oXcpt.excepinfo is not None and len(oXcpt.excepinfo) > 5: 199 hrc = oXcpt.excepinfo[5]; 200 sWhere = oXcpt.excepinfo[1]; 201 sMsg = oXcpt.excepinfo[2]; 202 else: 203 sWhere = None; 204 sMsg = oXcpt.strerror; 205 else: 206 hrc = oXcpt.errno; 207 sWhere = None; 208 sMsg = oXcpt.msg; 209 210 sHrc = oVBoxMgr.xcptToString(hrc); # pylint: disable=not-callable 211 if sHrc.find('(') < 0: 212 sHrc = '%s (%#x)' % (sHrc, hrc & 0xffffffff); 213 214 asRet = ['COM-Xcpt: %s' % (sHrc,)]; 215 if sMsg and sWhere: 216 asRet.append('--------- %s: %s' % (sWhere, sMsg,)); 217 elif sMsg: 218 asRet.append('--------- %s' % (sMsg,)); 219 return asRet; 220 #if sMsg and sWhere: 221 # return ['COM-Xcpt: %s - %s: %s' % (sHrc, sWhere, sMsg,)]; 222 #if sMsg: 223 # return ['COM-Xcpt: %s - %s' % (sHrc, sMsg,)]; 224 #return ['COM-Xcpt: %s' % (sHrc,)]; 184 225 185 226 # … … 1345 1386 vboxcon.goHackModuleClass.oVBoxMgr = self.oVBoxMgr; # VBoxConstantWrappingHack. 1346 1387 vboxcon.fpApiVer = self.fpApiVer; 1388 reporter.setComXcptFormatter(formatComOrXpComException); 1347 1389 1348 1390 except: … … 1432 1474 self.oVBox = None; 1433 1475 vboxcon.goHackModuleClass.oVBoxMgr = None; # VBoxConstantWrappingHack. 1476 reporter.setComXcptFormatter(None); 1434 1477 1435 1478 # Do garbage collection to try get rid of those objects.
Note:
See TracChangeset
for help on using the changeset viewer.