mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Clean Home Connect error handling (#139817)
This commit is contained in:
parent
1fb02944b7
commit
13dfd27b7e
@ -266,7 +266,7 @@ class HomeConnectCoordinator(
|
||||
_LOGGER.debug(
|
||||
"Non-breaking error (%s) while listening for events,"
|
||||
" continuing in %s seconds",
|
||||
type(error).__name__,
|
||||
error,
|
||||
retry_time,
|
||||
)
|
||||
await asyncio.sleep(retry_time)
|
||||
@ -343,9 +343,7 @@ class HomeConnectCoordinator(
|
||||
_LOGGER.debug(
|
||||
"Error fetching settings for %s: %s",
|
||||
appliance.ha_id,
|
||||
error
|
||||
if isinstance(error, HomeConnectApiError)
|
||||
else type(error).__name__,
|
||||
error,
|
||||
)
|
||||
settings = {}
|
||||
try:
|
||||
@ -357,9 +355,7 @@ class HomeConnectCoordinator(
|
||||
_LOGGER.debug(
|
||||
"Error fetching status for %s: %s",
|
||||
appliance.ha_id,
|
||||
error
|
||||
if isinstance(error, HomeConnectApiError)
|
||||
else type(error).__name__,
|
||||
error,
|
||||
)
|
||||
status = {}
|
||||
|
||||
@ -373,9 +369,7 @@ class HomeConnectCoordinator(
|
||||
_LOGGER.debug(
|
||||
"Error fetching programs for %s: %s",
|
||||
appliance.ha_id,
|
||||
error
|
||||
if isinstance(error, HomeConnectApiError)
|
||||
else type(error).__name__,
|
||||
error,
|
||||
)
|
||||
else:
|
||||
programs.extend(all_programs.programs)
|
||||
@ -465,9 +459,7 @@ class HomeConnectCoordinator(
|
||||
_LOGGER.debug(
|
||||
"Error fetching options for %s: %s",
|
||||
ha_id,
|
||||
error
|
||||
if isinstance(error, HomeConnectApiError)
|
||||
else type(error).__name__,
|
||||
error,
|
||||
)
|
||||
return {}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
import re
|
||||
|
||||
from aiohomeconnect.model.error import HomeConnectApiError, HomeConnectError
|
||||
from aiohomeconnect.model.error import HomeConnectError
|
||||
|
||||
RE_CAMEL_CASE = re.compile(r"(?<!^)(?=[A-Z])|(?=\d)(?<=\D)")
|
||||
|
||||
@ -11,11 +11,7 @@ def get_dict_from_home_connect_error(
|
||||
err: HomeConnectError,
|
||||
) -> dict[str, str]:
|
||||
"""Return a translation string from a Home Connect error."""
|
||||
return {
|
||||
"error": str(err)
|
||||
if isinstance(err, HomeConnectApiError)
|
||||
else type(err).__name__
|
||||
}
|
||||
return {"error": str(err)}
|
||||
|
||||
|
||||
def bsh_key_to_translation_key(bsh_key: str) -> str:
|
||||
|
Loading…
x
Reference in New Issue
Block a user