tty: make tty.* print exception types
- make tty.msg, tty.info, etc. print the exception type and stringified message if the message argument is an exception. - simplify parts of the code that call tty.debug(str(e)) - add extra tty.debug statements in places where exceptions were previously ignored
This commit is contained in:

committed by
Todd Gamblin

parent
8c173da4b7
commit
8e3fd3f7c2
@@ -141,6 +141,9 @@ def msg(message, *args, **kwargs):
|
||||
if not msg_enabled():
|
||||
return
|
||||
|
||||
if isinstance(message, Exception):
|
||||
message = "%s: %s" % (message.__class__.__name__, str(message))
|
||||
|
||||
newline = kwargs.get('newline', True)
|
||||
st_text = ""
|
||||
if _stacktrace:
|
||||
@@ -156,6 +159,9 @@ def msg(message, *args, **kwargs):
|
||||
|
||||
|
||||
def info(message, *args, **kwargs):
|
||||
if isinstance(message, Exception):
|
||||
message = "%s: %s" % (message.__class__.__name__, str(message))
|
||||
|
||||
format = kwargs.get('format', '*b')
|
||||
stream = kwargs.get('stream', sys.stdout)
|
||||
wrap = kwargs.get('wrap', False)
|
||||
|
Reference in New Issue
Block a user