Update: Major code refactor
CI/CD Pipeline / Unit Tests (Python 3.12) (push) Successful in 30s
CI/CD Pipeline / Unit Tests (Python 3.13) (push) Successful in 35s
CI/CD Pipeline / Code Quality & Linting (push) Successful in 27s
CI/CD Pipeline / Security Scanning (push) Successful in 2m23s
CI/CD Pipeline / Unit Tests (Python 3.11) (push) Successful in 24s
CI/CD Pipeline / Integration Tests (push) Successful in 26s
CI/CD Pipeline / Generate Test Report (push) Successful in 9s
CI/CD Pipeline / Build Docker Image (push) Successful in 41s
CI/CD Pipeline / CI/CD Pipeline Status (push) Successful in 2s

This commit is contained in:
k.eaven committed 2026-10-24 10:53:09 +00:00
1 parent d891b21ffd
commit 3e03939fd0
13 files changed
+3266 -443

No files matched your search

+84
View File
@@ -0,0 +1,84 @@
"""
Custom Exception Classes
Defines application-specific exceptions for better error handling
and clearer error messages throughout the codebase.
"""
class PterodisBotError(Exception):
"""Base exception class for all PterodisBot errors."""
pass
class ConfigValidationError(PterodisBotError):
"""
Raised when configuration validation fails.
Contains detailed error messages for all validation failures.
"""
pass
class APIError(PterodisBotError):
"""
Raised when an API request fails.
Attributes:
endpoint: The API endpoint that failed
status_code: HTTP status code if available
message: Error message from the API
"""
def __init__(
self,
message: str,
endpoint: str = "",
status_code: int = 0,
) -> None:
super().__init__(message)
self.endpoint = endpoint
self.status_code = status_code
self.message = message
class ServerNotFoundError(PterodisBotError):
"""
Raised when a requested server is not found in the panel.
"""
pass
class PermissionError(PterodisBotError):
"""
Raised when a user lacks required permissions for an action.
"""
pass
class EmbedNotFoundError(PterodisBotError):
"""
Raised when a tracked embed message is not found in Discord.
"""
pass
class MetricsError(PterodisBotError):
"""
Raised when metrics graph generation fails.
"""
pass
class ConfigurationError(PterodisBotError):
"""
Raised when there's a configuration issue not caught during startup validation.
"""
pass