Skip to content

Conversation

@iMicknl
Copy link
Owner

@iMicknl iMicknl commented Jan 25, 2026

This pull request enhances error handling in the Overkiz client by introducing two new custom exceptions and updating the response checking logic to catch and raise these exceptions based on specific API error messages. Additionally, it refines and clarifies the error message comments for better maintainability.

Error handling improvements:

  • Added two new exception classes, DuplicateActionOnDeviceException and ActionGroupSetupNotFoundException, to pyoverkiz/exceptions.py for handling specific API error cases.
  • Updated pyoverkiz/client.py to import the new exceptions.
  • Modified the check_response function in pyoverkiz/client.py to detect error messages indicating a duplicate action on a device or a missing action group setup, and to raise the corresponding new exceptions.

Documentation and code clarity:

  • Updated comments in check_response to use consistent JSON-style formatting for API error messages, improving readability and maintainability. [1] [2] [3]

Fixes #1918

Copilot AI review requested due to automatic review settings January 25, 2026 22:33
@iMicknl iMicknl requested a review from tetienne as a code owner January 25, 2026 22:33
@github-actions github-actions bot added the enhancement New feature or request label Jan 25, 2026
Copy link
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

Introduces two new Overkiz-specific exceptions and updates response parsing so the client can raise more precise errors when the API returns known “duplicate action” and “missing action group setup” failures.

Changes:

  • Added DuplicateActionOnDeviceException and ActionGroupSetupNotFoundException.
  • Updated check_response to detect two additional API error-message patterns and raise the new exceptions.
  • Normalized several inline error-message examples to consistent JSON-style formatting.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pyoverkiz/exceptions.py Adds two new custom exception classes for specific API error cases.
pyoverkiz/client.py Imports and raises the new exceptions based on matched API error messages; updates inline comment formatting.

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

@iMicknl iMicknl merged commit 13ca41d into main Jan 25, 2026
10 checks passed
@iMicknl iMicknl deleted the enhancement/improve_exceptions branch January 25, 2026 22:43
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.

Add additional exception handling

2 participants