refactor: Factor out Gitea interfacing into clean facade pattern
- Create new gitea/ package with clean API facade - Establish proper separation of concerns: tddai uses gitea, not vice versa - Replace duplicate curl+subprocess patterns with unified HTTP client - Add rich domain models with properties (issue.priority, issue.status) - Maintain full backwards compatibility in tddai modules - Reduce code complexity: -373 lines, +151 lines (net -222 lines) - Improve testability and maintainability through clean interfaces Architecture: - gitea.client.GiteaClient - main facade with sub-clients - gitea.api_client - high-level API with model conversion - gitea.http_client - low-level HTTP operations - gitea.models - rich domain objects (Issue, Milestone, Label) - gitea.config - gitea-specific configuration - gitea.exceptions - clean exception hierarchy 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
31
gitea/exceptions.py
Normal file
31
gitea/exceptions.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
Gitea-specific exceptions.
|
||||
"""
|
||||
|
||||
|
||||
class GiteaError(Exception):
|
||||
"""Base exception for Gitea API operations."""
|
||||
pass
|
||||
|
||||
|
||||
class GiteaAuthError(GiteaError):
|
||||
"""Raised when authentication fails or token is missing."""
|
||||
pass
|
||||
|
||||
|
||||
class GiteaNotFoundError(GiteaError):
|
||||
"""Raised when requested resource is not found."""
|
||||
pass
|
||||
|
||||
|
||||
class GiteaApiError(GiteaError):
|
||||
"""Raised when API returns an error response."""
|
||||
|
||||
def __init__(self, message: str, status_code: int = None):
|
||||
super().__init__(message)
|
||||
self.status_code = status_code
|
||||
|
||||
|
||||
class GiteaConfigError(GiteaError):
|
||||
"""Raised when Gitea configuration is invalid or missing."""
|
||||
pass
|
||||
Reference in New Issue
Block a user