Skip to content

Add ApplicationNotAllowedException and update related tests#1963

Merged
iMicknl merged 2 commits intomainfrom
enhancement/application-not-allowed-exception
Mar 30, 2026
Merged

Add ApplicationNotAllowedException and update related tests#1963
iMicknl merged 2 commits intomainfrom
enhancement/application-not-allowed-exception

Conversation

@iMicknl
Copy link
Copy Markdown
Owner

@iMicknl iMicknl commented Mar 30, 2026

This pull request introduces a new exception, ApplicationNotAllowedException, to handle cases where access to a setup is denied for a specific application. It also refactors the exception hierarchy to group related access-denied errors under a new base class, ResourceAccessDeniedException. Additionally, tests and fixtures are updated to cover the new exception.

Exception hierarchy improvements:

  • Introduced a new base exception, ResourceAccessDeniedException, and updated NotAuthenticatedException, MissingAuthorizationTokenException, and AccessDeniedToGatewayException to inherit from it for better error categorization. [1] [2] [3]

New exception for application access denial:

  • Added ApplicationNotAllowedException (inheriting from ResourceAccessDeniedException) for handling cases when the API returns a "RESOURCE_ACCESS_DENIED" error with the message "Your setup cannot be accessed through this application". [1] [2] [3]

Test and fixture updates:

  • Added a new test fixture (cloud/resource-access-denied.json) and updated tests to verify that ApplicationNotAllowedException is raised for the appropriate error response. [1] [2]

Copilot AI review requested due to automatic review settings March 30, 2026 20:15
@iMicknl iMicknl requested a review from tetienne as a code owner March 30, 2026 20:15
@github-actions github-actions bot added the enhancement New feature or request label Mar 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the client’s error-to-exception mapping to recognize a specific RESOURCE_ACCESS_DENIED scenario (“Your setup cannot be accessed through this application”) and adds a corresponding test fixture to validate the new behavior.

Changes:

  • Added ApplicationNotAllowedException (and introduced a ResourceAccessDeniedException base class for related errors).
  • Updated OverkizClient.check_response() to raise ApplicationNotAllowedException for the new cloud error message.
  • Added a new cloud exception fixture and expanded the parameterized client exception tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
pyoverkiz/exceptions.py Adds new exception types and refactors some existing exceptions under a shared ResourceAccessDeniedException base.
pyoverkiz/client.py Maps the new cloud error message to ApplicationNotAllowedException.
tests/test_client.py Adds a new parameterized test case to assert the new exception is raised.
tests/fixtures/exceptions/cloud/resource-access-denied.json Adds fixture payload for the new RESOURCE_ACCESS_DENIED error message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@iMicknl iMicknl merged commit 1ae8daa into main Mar 30, 2026
13 checks passed
@iMicknl iMicknl deleted the enhancement/application-not-allowed-exception branch March 30, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants