From 7e8981a8914e487f834ad9853365c935bfd1d25b Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 3 Apr 2015 16:10:41 -0700 Subject: [PATCH] Avoid going into causes of non-taskflow exceptions Change-Id: If043bf27f3b025a279f3747841e9a88fcc5fab85 --- taskflow/exceptions.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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()