Skip to content

Commit

Permalink
py3: remove tb_list
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr. Outis committed Jan 7, 2020
1 parent 7ed4fd3 commit f942e26
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions dvc/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,27 +102,23 @@ def _description(self, message, exception):

def _walk_exc(self, exc_info):
exc = exc_info[1]
tb = traceback.format_exc(*exc_info)

exc_list = [str(exc)]
tb_list = [tb]

# NOTE: parsing chained exceptions. See dvc/exceptions.py for more info
while hasattr(exc, "__cause__") and exc.__cause__:
exc_list.append(str(exc.__cause__))
if hasattr(exc, "cause_tb") and exc.cause_tb:
tb_list.insert(0, str(exc.cause_tb))
exc = exc.__cause__

return exc_list, tb_list
return exc_list

def _parse_exc(self, record):
tb_only = getattr(record, "tb_only", False)

if not record.exc_info:
return (None, "")

exc_list, tb_list = self._walk_exc(record.exc_info)
exc_list = self._walk_exc(record.exc_info)
tb = traceback.format_exception(*record.exc_info)

exception = None if tb_only else ": ".join(exc_list)

Expand All @@ -133,7 +129,7 @@ def _parse_exc(self, record):
red=colorama.Fore.RED,
nc=colorama.Fore.RESET,
line="-" * 60,
stack_trace="\n".join(tb_list),
stack_trace="".join(tb),
)
else:
stack_trace = ""
Expand Down

0 comments on commit f942e26

Please sign in to comment.