mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
check we have a tb (#21670)
This commit is contained in:
parent
efa5d5dfe3
commit
efe4ce9a05
@ -91,15 +91,15 @@ class LogEntry:
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user