Skip to content

Simplify error handling and move response checks to a response_handler module#1977

Merged
iMicknl merged 3 commits intov2/mainfrom
v2/simplify_error_handling
Apr 7, 2026
Merged

Simplify error handling and move response checks to a response_handler module#1977
iMicknl merged 3 commits intov2/mainfrom
v2/simplify_error_handling

Conversation

@iMicknl
Copy link
Copy Markdown
Owner

@iMicknl iMicknl commented Apr 6, 2026

Breaking change

  • OverkizClient.check_response was removed and replaced with the module-level pyoverkiz.response_handler.check_response

Copilot AI review requested due to automatic review settings April 6, 2026 21:00
@iMicknl iMicknl requested a review from tetienne as a code owner April 6, 2026 21:00
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 centralizes HTTP response validation by moving Overkiz API error-to-exception mapping out of OverkizClient into a dedicated response_handler module, and expands test coverage with additional cloud error fixtures.

Changes:

  • Added pyoverkiz.response_handler.check_response with rule-based dispatch for mapping API error payloads to specific exceptions.
  • Updated OverkizClient request helpers to call the shared check_response function instead of a class staticmethod.
  • Extended tests/test_client.py and added multiple new cloud exception fixtures to validate additional error mappings and fallbacks.

Reviewed changes

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

Show a summary per file
File Description
pyoverkiz/client.py Replaces internal response checking with calls to the new shared check_response function (and removes the previous staticmethod).
pyoverkiz/response_handler.py Introduces centralized response checking and exception dispatch logic.
tests/test_client.py Updates tests to call the shared response handler and adds new exception cases.
tests/fixtures/exceptions/cloud/exec-queue-full.json New fixture to validate EXEC_QUEUE_FULLExecutionQueueFullException.
tests/fixtures/exceptions/cloud/invalid-event-listener-id.json New fixture to validate invalid event listener ID mapping.
tests/fixtures/exceptions/cloud/invalid-token.json New fixture to validate invalid token mapping.
tests/fixtures/exceptions/cloud/missing-api-key.json New fixture to validate missing API key mapping.
tests/fixtures/exceptions/cloud/no-such-command.json New fixture to validate unsupported operation / invalid command mapping.
tests/fixtures/exceptions/cloud/no-such-resource.json New fixture to validate invalid API call / no-such-resource mapping.
tests/fixtures/exceptions/cloud/not-such-token.json New fixture to validate “not such token” mapping.
tests/fixtures/exceptions/cloud/session-and-bearer.json New fixture to validate session+bearing token conflict mapping.
tests/fixtures/exceptions/cloud/too-many-attempts-banned.json New fixture to validate temporary ban mapping.
tests/fixtures/exceptions/cloud/unknown-auth-error.json New fixture to validate authentication error fallback behavior.
tests/fixtures/exceptions/cloud/unknown-resource-access-denied.json New fixture to validate resource access denied fallback behavior.
tests/fixtures/exceptions/cloud/unknown-user-account.json New fixture to validate unknown user mapping.

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

@iMicknl iMicknl merged commit d3fa87a into v2/main Apr 7, 2026
6 checks passed
@iMicknl iMicknl deleted the v2/simplify_error_handling branch April 7, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants