- Add shared config.py with API URLs, regexes, timeouts, pagination - Add GiteaClient and VikunjaClient in api_clients.py with pooled sessions - Add APIError exception for unified HTTP error handling - Refactor all scripts to use shared modules and http.HTTPStatus - Rewrite unit tests to mock clients and use HTTPStatus constants - Add tests for api_clients and config modules - Achieve 100% test coverage
23 lines
504 B
Python
23 lines
504 B
Python
"""Custom exceptions for Gitea Runner Manager."""
|
|
|
|
|
|
class GRMError(Exception):
|
|
"""Base exception for all Gitea Runner Manager errors."""
|
|
|
|
pass
|
|
|
|
|
|
class AnsibleError(GRMError):
|
|
"""Raised when an Ansible command fails."""
|
|
|
|
pass
|
|
|
|
|
|
class APIError(GRMError):
|
|
"""Raised when a REST API call returns an HTTP error."""
|
|
|
|
def __init__(self, status: int, message: str) -> None:
|
|
self.status = status
|
|
self.message = message
|
|
super().__init__(f"HTTP {status}: {message}")
|