Skip to content

Commit 9014b84

Browse files
authored
Raise an exception instead of returning None on error (#111)
1 parent 66b0df5 commit 9014b84

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

switchbot/devices/device.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ async def _send_command(self, key: str, retry: int | None = None) -> bytes | Non
162162
self.rssi,
163163
exc_info=True,
164164
)
165-
return None
165+
raise
166166
except CharacteristicMissingError as ex:
167167
if attempt == retry:
168168
_LOGGER.error(
@@ -172,7 +172,7 @@ async def _send_command(self, key: str, retry: int | None = None) -> bytes | Non
172172
self.rssi,
173173
exc_info=True,
174174
)
175-
return None
175+
raise
176176

177177
_LOGGER.debug(
178178
"%s: characteristic missing: %s; RSSI: %s",
@@ -189,7 +189,7 @@ async def _send_command(self, key: str, retry: int | None = None) -> bytes | Non
189189
self.rssi,
190190
exc_info=True,
191191
)
192-
return None
192+
raise
193193

194194
_LOGGER.debug(
195195
"%s: communication failed with:", self.name, exc_info=True

0 commit comments

Comments
 (0)