Skip to content

Commit

Permalink
check we have a tb (#21670)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgomes authored and balloob committed Mar 5, 2019
1 parent 2303e16 commit 4978a16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions homeassistant/components/system_log/__init__.py
Expand Up @@ -91,15 +91,15 @@ def __init__(self, record, stack, source):
self.first_occured = self.timestamp = record.created
self.level = record.levelname
self.message = record.getMessage()
self.exception = ''
self.root_cause = None
if record.exc_info:
self.exception = ''.join(
traceback.format_exception(*record.exc_info))
_, _, tb = record.exc_info # pylint: disable=invalid-name
# Last line of traceback contains the root cause of the exception
self.root_cause = str(traceback.extract_tb(tb)[-1])
else:
self.exception = ''
self.root_cause = None
if traceback.extract_tb(tb):
self.root_cause = str(traceback.extract_tb(tb)[-1])
self.source = source
self.count = 1

Expand Down

0 comments on commit 4978a16

Please sign in to comment.