mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +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(
|
_LOGGER.debug(
|
||||||
"Non-breaking error (%s) while listening for events,"
|
"Non-breaking error (%s) while listening for events,"
|
||||||
" continuing in %s seconds",
|
" continuing in %s seconds",
|
||||||
type(error).__name__,
|
error,
|
||||||
retry_time,
|
retry_time,
|
||||||
)
|
)
|
||||||
await asyncio.sleep(retry_time)
|
await asyncio.sleep(retry_time)
|
||||||
@ -343,9 +343,7 @@ class HomeConnectCoordinator(
|
|||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Error fetching settings for %s: %s",
|
"Error fetching settings for %s: %s",
|
||||||
appliance.ha_id,
|
appliance.ha_id,
|
||||||
error
|
error,
|
||||||
if isinstance(error, HomeConnectApiError)
|
|
||||||
else type(error).__name__,
|
|
||||||
)
|
)
|
||||||
settings = {}
|
settings = {}
|
||||||
try:
|
try:
|
||||||
@ -357,9 +355,7 @@ class HomeConnectCoordinator(
|
|||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Error fetching status for %s: %s",
|
"Error fetching status for %s: %s",
|
||||||
appliance.ha_id,
|
appliance.ha_id,
|
||||||
error
|
error,
|
||||||
if isinstance(error, HomeConnectApiError)
|
|
||||||
else type(error).__name__,
|
|
||||||
)
|
)
|
||||||
status = {}
|
status = {}
|
||||||
|
|
||||||
@ -373,9 +369,7 @@ class HomeConnectCoordinator(
|
|||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Error fetching programs for %s: %s",
|
"Error fetching programs for %s: %s",
|
||||||
appliance.ha_id,
|
appliance.ha_id,
|
||||||
error
|
error,
|
||||||
if isinstance(error, HomeConnectApiError)
|
|
||||||
else type(error).__name__,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
programs.extend(all_programs.programs)
|
programs.extend(all_programs.programs)
|
||||||
@ -465,9 +459,7 @@ class HomeConnectCoordinator(
|
|||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Error fetching options for %s: %s",
|
"Error fetching options for %s: %s",
|
||||||
ha_id,
|
ha_id,
|
||||||
error
|
error,
|
||||||
if isinstance(error, HomeConnectApiError)
|
|
||||||
else type(error).__name__,
|
|
||||||
)
|
)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import re
|
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)")
|
RE_CAMEL_CASE = re.compile(r"(?<!^)(?=[A-Z])|(?=\d)(?<=\D)")
|
||||||
|
|
||||||
@ -11,11 +11,7 @@ def get_dict_from_home_connect_error(
|
|||||||
err: HomeConnectError,
|
err: HomeConnectError,
|
||||||
) -> dict[str, str]:
|
) -> dict[str, str]:
|
||||||
"""Return a translation string from a Home Connect error."""
|
"""Return a translation string from a Home Connect error."""
|
||||||
return {
|
return {"error": str(err)}
|
||||||
"error": str(err)
|
|
||||||
if isinstance(err, HomeConnectApiError)
|
|
||||||
else type(err).__name__
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def bsh_key_to_translation_key(bsh_key: str) -> str:
|
def bsh_key_to_translation_key(bsh_key: str) -> str:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user