roborock.exceptions
Roborock exceptions.
1"""Roborock exceptions.""" 2 3from enum import Enum 4from typing import Any 5 6 7class RoborockException(Exception): 8 """Class for Roborock exceptions.""" 9 10 11class RoborockTimeout(RoborockException): 12 """Class for Roborock timeout exceptions.""" 13 14 15class RoborockConnectionException(RoborockException): 16 """Class for Roborock connection exceptions.""" 17 18 19class RoborockBackoffException(RoborockException): 20 """Class for Roborock exceptions when many retries were made.""" 21 22 23class VacuumError(RoborockException): 24 """Class for vacuum errors.""" 25 26 27class CommandVacuumError(RoborockException): 28 """Class for command vacuum errors.""" 29 30 def __init__(self, command: str | None, vacuum_error: VacuumError): 31 self.message = f"{command or 'unknown'}: {str(vacuum_error)}" 32 super().__init__(self.message) 33 34 35class UnknownMethodError(RoborockException): 36 """Class for an invalid method being sent.""" 37 38 39class RoborockAccountDoesNotExist(RoborockException): 40 """Class for Roborock account does not exist exceptions.""" 41 42 43class RoborockUrlException(RoborockException): 44 """Class for being unable to get the URL for the Roborock account.""" 45 46 47class RoborockInvalidCode(RoborockException): 48 """Class for Roborock invalid code exceptions.""" 49 50 51class RoborockInvalidEmail(RoborockException): 52 """Class for Roborock invalid formatted email exceptions.""" 53 54 55class RoborockInvalidUserAgreement(RoborockException): 56 """Class for Roborock invalid user agreement exceptions.""" 57 58 59class RoborockNoUserAgreement(RoborockException): 60 """Class for Roborock no user agreement exceptions.""" 61 62 63class RoborockInvalidCredentials(RoborockException): 64 """Class for Roborock credentials have expired or changed.""" 65 66 67class RoborockTooFrequentCodeRequests(RoborockException): 68 """Class for Roborock too frequent code requests exceptions.""" 69 70 71class RoborockMissingParameters(RoborockException): 72 """Class for Roborock missing parameters exceptions.""" 73 74 75class RoborockTooManyRequest(RoborockException): 76 """Class for Roborock too many request exceptions.""" 77 78 79class RoborockRateLimit(RoborockException): 80 """Class for our rate limits exceptions.""" 81 82 83class RoborockNoResponseFromBaseURL(RoborockException): 84 """We could not find an url that had a record of the given account.""" 85 86 87class RoborockDeviceBusy(RoborockException): 88 """Class for Roborock device busy exceptions.""" 89 90 91class RoborockInvalidStatus(RoborockException): 92 """Class for Roborock invalid status exceptions (device action locked).""" 93 94 95class RoborockUnsupportedFeature(RoborockException): 96 """Class for Roborock unsupported feature exceptions.""" 97 98 99class RoborockParsingException(RoborockException): 100 """Class for Roborock exceptions when parsing device responses.""" 101 102 def __init__(self, trait_name: str, command: Enum | str, payload: Any, inner_error: Exception | str) -> None: 103 cmd_name = command.name if isinstance(command, Enum) else str(command) 104 self.message = ( 105 f"Failed to parse {cmd_name} response for {trait_name}. Payload: {payload!r} Error: {inner_error!r}" 106 ) 107 super().__init__(self.message)
Class for Roborock exceptions.
Class for Roborock timeout exceptions.
16class RoborockConnectionException(RoborockException): 17 """Class for Roborock connection exceptions."""
Class for Roborock connection exceptions.
20class RoborockBackoffException(RoborockException): 21 """Class for Roborock exceptions when many retries were made."""
Class for Roborock exceptions when many retries were made.
Class for vacuum errors.
28class CommandVacuumError(RoborockException): 29 """Class for command vacuum errors.""" 30 31 def __init__(self, command: str | None, vacuum_error: VacuumError): 32 self.message = f"{command or 'unknown'}: {str(vacuum_error)}" 33 super().__init__(self.message)
Class for command vacuum errors.
Class for an invalid method being sent.
40class RoborockAccountDoesNotExist(RoborockException): 41 """Class for Roborock account does not exist exceptions."""
Class for Roborock account does not exist exceptions.
44class RoborockUrlException(RoborockException): 45 """Class for being unable to get the URL for the Roborock account."""
Class for being unable to get the URL for the Roborock account.
48class RoborockInvalidCode(RoborockException): 49 """Class for Roborock invalid code exceptions."""
Class for Roborock invalid code exceptions.
52class RoborockInvalidEmail(RoborockException): 53 """Class for Roborock invalid formatted email exceptions."""
Class for Roborock invalid formatted email exceptions.
56class RoborockInvalidUserAgreement(RoborockException): 57 """Class for Roborock invalid user agreement exceptions."""
Class for Roborock invalid user agreement exceptions.
60class RoborockNoUserAgreement(RoborockException): 61 """Class for Roborock no user agreement exceptions."""
Class for Roborock no user agreement exceptions.
64class RoborockInvalidCredentials(RoborockException): 65 """Class for Roborock credentials have expired or changed."""
Class for Roborock credentials have expired or changed.
68class RoborockTooFrequentCodeRequests(RoborockException): 69 """Class for Roborock too frequent code requests exceptions."""
Class for Roborock too frequent code requests exceptions.
72class RoborockMissingParameters(RoborockException): 73 """Class for Roborock missing parameters exceptions."""
Class for Roborock missing parameters exceptions.
76class RoborockTooManyRequest(RoborockException): 77 """Class for Roborock too many request exceptions."""
Class for Roborock too many request exceptions.
Class for our rate limits exceptions.
84class RoborockNoResponseFromBaseURL(RoborockException): 85 """We could not find an url that had a record of the given account."""
We could not find an url that had a record of the given account.
Class for Roborock device busy exceptions.
92class RoborockInvalidStatus(RoborockException): 93 """Class for Roborock invalid status exceptions (device action locked)."""
Class for Roborock invalid status exceptions (device action locked).
96class RoborockUnsupportedFeature(RoborockException): 97 """Class for Roborock unsupported feature exceptions."""
Class for Roborock unsupported feature exceptions.
100class RoborockParsingException(RoborockException): 101 """Class for Roborock exceptions when parsing device responses.""" 102 103 def __init__(self, trait_name: str, command: Enum | str, payload: Any, inner_error: Exception | str) -> None: 104 cmd_name = command.name if isinstance(command, Enum) else str(command) 105 self.message = ( 106 f"Failed to parse {cmd_name} response for {trait_name}. Payload: {payload!r} Error: {inner_error!r}" 107 ) 108 super().__init__(self.message)
Class for Roborock exceptions when parsing device responses.
103 def __init__(self, trait_name: str, command: Enum | str, payload: Any, inner_error: Exception | str) -> None: 104 cmd_name = command.name if isinstance(command, Enum) else str(command) 105 self.message = ( 106 f"Failed to parse {cmd_name} response for {trait_name}. Payload: {payload!r} Error: {inner_error!r}" 107 ) 108 super().__init__(self.message)