Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pyoverkiz/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ class ApplicationNotAllowedError(ResourceAccessDeniedError):
"""Raised when the setup cannot be accessed through the application."""


class NoOverkizUserError(ResourceAccessDeniedError):
"""Raised when the account authenticated but has no Overkiz user on this server.

Login succeeds, but the token is not bound to an Overkiz user on this
endpoint. Seen for Somfy accounts that need the site-scoped multi-account
flow rather than the classic single-endpoint login.
"""


# Nexity
class NexityBadCredentialsError(BadCredentialsError):
"""Raised when invalid credentials are provided to Nexity authentication API."""
Expand Down
2 changes: 2 additions & 0 deletions pyoverkiz/response_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
MaintenanceError,
MissingAPIKeyError,
MissingAuthorizationTokenError,
NoOverkizUserError,
NoRegisteredEventListenerError,
NoSuchActionGroupError,
NoSuchDeviceError,
Expand Down Expand Up @@ -61,6 +62,7 @@
("AUTHENTICATION_ERROR", "API key is required", MissingAPIKeyError),
("AUTHENTICATION_ERROR", "No such user account", UnknownUserError),
("RESOURCE_ACCESS_DENIED", "Not authenticated", NotAuthenticatedError),
("RESOURCE_ACCESS_DENIED", "No such user account", NoOverkizUserError),
(
"RESOURCE_ACCESS_DENIED",
"Missing authorization token",
Expand Down
4 changes: 4 additions & 0 deletions tests/fixtures/exceptions/cloud/no-overkiz-user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"errorCode": "RESOURCE_ACCESS_DENIED",
"error": "No such user account : user@example.tld"
}
5 changes: 5 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,11 @@ async def test_get_diagnostic_data_returns_structured_dict(
exceptions.UnknownUserError,
400,
),
(
"cloud/no-overkiz-user.json",
exceptions.NoOverkizUserError,
403,
),
(
"cloud/no-such-command.json",
exceptions.InvalidCommandError,
Expand Down