Skip to content

Commit

Permalink
fix: error catch and typing (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lash-L authored Oct 29, 2023
1 parent 316fc0d commit 171c302
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion roborock/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ def on_message_received(self, messages: list[RoborockMessage]) -> None:
payload = data.payload[0:24]
[endpoint, _, request_id, _] = struct.unpack("<8s8sH6s", payload)
if endpoint.decode().startswith(self._endpoint):
decrypted = Utils.decrypt_cbc(data.payload[24:], self._nonce)
try:
decrypted = Utils.decrypt_cbc(data.payload[24:], self._nonce)
except ValueError as err:
raise RoborockException("Failed to decode %s for %s", data.payload, data.protocol) from err
decompressed = Utils.decompress(decrypted)
queue = self._waiting_queue.get(request_id)
if queue:
Expand Down
Empty file added roborock/py.typed
Empty file.

0 comments on commit 171c302

Please sign in to comment.