mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 17:57:55 +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.first_occured = self.timestamp = record.created
|
||||||
self.level = record.levelname
|
self.level = record.levelname
|
||||||
self.message = record.getMessage()
|
self.message = record.getMessage()
|
||||||
|
self.exception = ''
|
||||||
|
self.root_cause = None
|
||||||
if record.exc_info:
|
if record.exc_info:
|
||||||
self.exception = ''.join(
|
self.exception = ''.join(
|
||||||
traceback.format_exception(*record.exc_info))
|
traceback.format_exception(*record.exc_info))
|
||||||
_, _, tb = record.exc_info # pylint: disable=invalid-name
|
_, _, tb = record.exc_info # pylint: disable=invalid-name
|
||||||
# Last line of traceback contains the root cause of the exception
|
# Last line of traceback contains the root cause of the exception
|
||||||
self.root_cause = str(traceback.extract_tb(tb)[-1])
|
if traceback.extract_tb(tb):
|
||||||
else:
|
self.root_cause = str(traceback.extract_tb(tb)[-1])
|
||||||
self.exception = ''
|
|
||||||
self.root_cause = None
|
|
||||||
self.source = source
|
self.source = source
|
||||||
self.count = 1
|
self.count = 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user