forked from qt-creator/qt-creator
Allow custom handling of python Dumper warnings/exceptions
Change-Id: I04108a09c317675d597bb6d0d58331c70ce02fb9 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -152,27 +152,18 @@ class ReportItem:
|
||||
|
||||
|
||||
def warn(message):
|
||||
print('bridgemessage={msg="%s"},' % message.replace('"', '$').encode('latin1'))
|
||||
DumperBase.warn(message)
|
||||
|
||||
def xwarn(message):
|
||||
print('bridgemessage={msg="%s"},' % message.replace('"', '$').encode('latin1'))
|
||||
warn(message)
|
||||
import traceback
|
||||
traceback.print_stack()
|
||||
|
||||
|
||||
def error(message):
|
||||
raise RuntimeError(message)
|
||||
|
||||
|
||||
def showException(msg, exType, exValue, exTraceback):
|
||||
warn('**** CAUGHT EXCEPTION: %s ****' % msg)
|
||||
try:
|
||||
import traceback
|
||||
for line in traceback.format_exception(exType, exValue, exTraceback):
|
||||
warn('%s' % line)
|
||||
except:
|
||||
pass
|
||||
|
||||
DumperBase.showException(msg, exType, exValue, exTraceback)
|
||||
|
||||
class Children:
|
||||
def __init__(self, d, numChild = 1, childType = None, childNumChild = None,
|
||||
@@ -248,6 +239,20 @@ class UnnamedSubItem(SubItem):
|
||||
self.name = None
|
||||
|
||||
class DumperBase:
|
||||
@staticmethod
|
||||
def warn(message):
|
||||
print('bridgemessage={msg="%s"},' % message.replace('"', '$').encode('latin1'))
|
||||
|
||||
@staticmethod
|
||||
def showException(msg, exType, exValue, exTraceback):
|
||||
warn('**** CAUGHT EXCEPTION: %s ****' % msg)
|
||||
try:
|
||||
import traceback
|
||||
for line in traceback.format_exception(exType, exValue, exTraceback):
|
||||
warn('%s' % line)
|
||||
except:
|
||||
pass
|
||||
|
||||
def __init__(self):
|
||||
self.isCdb = False
|
||||
self.isGdb = False
|
||||
|
||||
Reference in New Issue
Block a user