mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 05:06:13 +01:00
Add full debug logs for coordinator failures (#163228)
This commit is contained in:
@@ -420,6 +420,7 @@ class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol, Generic[_DataT]):
|
||||
if self.last_update_success:
|
||||
if log_failures:
|
||||
self.logger.error("Timeout fetching %s data", self.name)
|
||||
self.logger.debug("Full error:", exc_info=True)
|
||||
self.last_update_success = False
|
||||
|
||||
except (aiohttp.ClientError, requests.exceptions.RequestException) as err:
|
||||
@@ -427,6 +428,7 @@ class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol, Generic[_DataT]):
|
||||
if self.last_update_success:
|
||||
if log_failures:
|
||||
self.logger.error("Error requesting %s data: %s", self.name, err)
|
||||
self.logger.debug("Full error:", exc_info=True)
|
||||
self.last_update_success = False
|
||||
|
||||
except urllib.error.URLError as err:
|
||||
@@ -439,6 +441,7 @@ class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol, Generic[_DataT]):
|
||||
self.logger.error(
|
||||
"Error requesting %s data: %s", self.name, err
|
||||
)
|
||||
self.logger.debug("Full error:", exc_info=True)
|
||||
self.last_update_success = False
|
||||
|
||||
except UpdateFailed as err:
|
||||
@@ -456,6 +459,7 @@ class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol, Generic[_DataT]):
|
||||
if self.last_update_success:
|
||||
if log_failures:
|
||||
self.logger.error("Error fetching %s data: %s", self.name, err)
|
||||
self.logger.debug("Full error:", exc_info=True)
|
||||
self.last_update_success = False
|
||||
|
||||
except ConfigEntryError as err:
|
||||
@@ -467,6 +471,7 @@ class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol, Generic[_DataT]):
|
||||
self.name,
|
||||
err,
|
||||
)
|
||||
self.logger.debug("Full error:", exc_info=True)
|
||||
self.last_update_success = False
|
||||
if raise_on_entry_error:
|
||||
raise
|
||||
@@ -481,6 +486,7 @@ class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol, Generic[_DataT]):
|
||||
self.name,
|
||||
err,
|
||||
)
|
||||
self.logger.debug("Full error:", exc_info=True)
|
||||
self.last_update_success = False
|
||||
if raise_on_auth_failed:
|
||||
raise
|
||||
|
||||
@@ -82,7 +82,7 @@ async def test_sensors_disappearing(
|
||||
sensor = hass.states.get("sensor.station_a_relative_pressure")
|
||||
assert sensor is not None
|
||||
assert sensor.state == "unavailable"
|
||||
assert caplog.text.count("Cannot connect to Ambient Network") == 1
|
||||
assert caplog.text.count("Cannot connect to Ambient Network") == 3
|
||||
|
||||
# Network comes back. Sensor should start reporting again. Log message
|
||||
# should only show up once.
|
||||
|
||||
Reference in New Issue
Block a user