Skip to content

Commit

Permalink
Add support for 'object offline' errors
Browse files Browse the repository at this point in the history
  • Loading branch information
loopj committed Dec 24, 2024
1 parent 8af71f1 commit 641cf40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/aiovantage/command_client/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
InvalidObjectError,
LoginFailedError,
LoginRequiredError,
ObjectOfflineError,
)

from .utils import encode_params, tokenize_response
Expand Down Expand Up @@ -187,6 +188,8 @@ def _parse_command_error(self, message: str) -> CommandError:
exc: CommandError
if error_code == 7:
exc = InvalidObjectError(error_message)
elif error_code == 20:
exc = ObjectOfflineError(error_message)
elif error_code == 21:
exc = LoginRequiredError(error_message)
elif error_code == 23:
Expand Down
4 changes: 4 additions & 0 deletions src/aiovantage/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ class LoginRequiredError(CommandError):

class InvalidObjectError(CommandError):
"""The requested object ID is invalid."""


class ObjectOfflineError(CommandError):
"""The requested object is offline."""

0 comments on commit 641cf40

Please sign in to comment.