From dbb4c1b5f0615225a964322eeb78d38814f29223 Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Sun, 19 Dec 2021 14:58:34 -0700 Subject: [PATCH] Replace RainMachine logged errors with HomeAssistantError in service handlers (#62350) --- .../components/rainmachine/switch.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/rainmachine/switch.py b/homeassistant/components/rainmachine/switch.py index ddda36c13e8..d96b145300e 100644 --- a/homeassistant/components/rainmachine/switch.py +++ b/homeassistant/components/rainmachine/switch.py @@ -30,7 +30,6 @@ from .const import ( DATA_ZONES, DEFAULT_ZONE_RUN, DOMAIN, - LOGGER, ) ATTR_AREA = "area" @@ -215,22 +214,14 @@ class RainMachineBaseSwitch(RainMachineEntity, SwitchEntity): try: resp = await api_coro except RequestError as err: - LOGGER.error( - 'Error while executing %s on "%s": %s', - api_coro.__name__, - self.name, - err, - ) - return + raise HomeAssistantError( + f'Error while executing {api_coro.__name__} on "{self.name}": {err}', + ) from err if resp["statusCode"] != 0: - LOGGER.error( - 'Error while executing %s on "%s": %s', - api_coro.__name__, - self.name, - resp["message"], + raise HomeAssistantError( + f'Error while executing {api_coro.__name__} on "{self.name}": {resp["message"]}', ) - return # Because of how inextricably linked programs and zones are, anytime one is # toggled, we make sure to update the data of both coordinators: