diff --git a/taskflow/exceptions.py b/taskflow/exceptions.py index 069a2f2a..5d15355a 100644 --- a/taskflow/exceptions.py +++ b/taskflow/exceptions.py @@ -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()