Replace RainMachine logged errors with HomeAssistantError in service handlers (#62350)

pull/62357/head
Aaron Bach 2021-12-19 14:58:34 -07:00 committed by GitHub
parent 1baba2a807
commit dbb4c1b5f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 14 deletions

View File

@ -30,7 +30,6 @@ from .const import (
DATA_ZONES, DATA_ZONES,
DEFAULT_ZONE_RUN, DEFAULT_ZONE_RUN,
DOMAIN, DOMAIN,
LOGGER,
) )
ATTR_AREA = "area" ATTR_AREA = "area"
@ -215,22 +214,14 @@ class RainMachineBaseSwitch(RainMachineEntity, SwitchEntity):
try: try:
resp = await api_coro resp = await api_coro
except RequestError as err: except RequestError as err:
LOGGER.error( raise HomeAssistantError(
'Error while executing %s on "%s": %s', f'Error while executing {api_coro.__name__} on "{self.name}": {err}',
api_coro.__name__, ) from err
self.name,
err,
)
return
if resp["statusCode"] != 0: if resp["statusCode"] != 0:
LOGGER.error( raise HomeAssistantError(
'Error while executing %s on "%s": %s', f'Error while executing {api_coro.__name__} on "{self.name}": {resp["message"]}',
api_coro.__name__,
self.name,
resp["message"],
) )
return
# Because of how inextricably linked programs and zones are, anytime one is # Because of how inextricably linked programs and zones are, anytime one is
# toggled, we make sure to update the data of both coordinators: # toggled, we make sure to update the data of both coordinators: