Stop reading advanced logs on ConnectionError (#5900)

* Stop reading advanced logs on ConnectionError

If the client side connection closes with a `ConnectionError`, stop
reading the advanced logs.

This is very similar to ClientConnectionResetError which is easily
reproducable by having a log open and following in the browser and
then restaring Home Assistant. So far I wans't able to artificaially
reproduce the ConnectionError, but there are quite some reports on
Sentry so it seems to happen in real world.

* Warn on ConnectionError
This commit is contained in:
Stefan Agner 2025-05-20 17:04:25 +02:00 committed by GitHub
parent 3b575eedba
commit 4f35759fe3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -269,6 +269,13 @@ class APIHost(CoreSysAttributes):
err,
)
break
except ConnectionError as err:
_LOGGER.warning(
"%s raised when returning journal logs: %s",
type(err).__name__,
err,
)
break
except (ConnectionResetError, ClientPayloadError) as ex:
# ClientPayloadError is most likely caused by the closing the connection
raise APIError(