##// END OF EJS Templates
Handle string exceptions.
Gael Varoquaux -
Show More
@@ -15,6 +15,7 b' __docformat__ = "restructuredtext en"'
15 # Imports
15 # Imports
16 #-------------------------------------------------------------------------------
16 #-------------------------------------------------------------------------------
17 import sys
17 import sys
18 from traceback import format_list
18
19
19 class TracebackTrap(object):
20 class TracebackTrap(object):
20 """ Object to trap and format tracebacks.
21 """ Object to trap and format tracebacks.
@@ -73,8 +74,12 b' class TracebackTrap(object):'
73
74
74 # Go through the list of formatters and let them add their formatting.
75 # Go through the list of formatters and let them add their formatting.
75 traceback = {}
76 traceback = {}
76 for formatter in self.formatters:
77 try:
77 traceback[formatter.identifier] = formatter(*self.args)
78 for formatter in self.formatters:
78
79 traceback[formatter.identifier] = formatter(*self.args)
80 except:
81 # This works always, including with string exceptions.
82 traceback['fallback'] = repr(self.args)
83
79 message['traceback'] = traceback
84 message['traceback'] = traceback
80
85
General Comments 0
You need to be logged in to leave comments. Login now