Avoid going into causes of non-taskflow exceptions

Change-Id: If043bf27f3b025a279f3747841e9a88fcc5fab85
This commit is contained in:
Joshua Harlow
2015-04-03 16:10:41 -07:00
parent 97c1704730
commit 7e8981a891

View File

@@ -116,11 +116,13 @@ class TaskFlowException(Exception):
buf.write(line)
if i + 1 != len(lines):
buf.write(os.linesep)
if not isinstance(next_up, TaskFlowException):
# Don't go deeper into non-taskflow exceptions... as we
# don't know if there exception 'cause' attributes are even
# useable objects...
break
active_indent += indent
try:
next_up = next_up.cause
except AttributeError:
next_up = None
next_up = getattr(next_up, 'cause', None)
return buf.getvalue()