Add exceptions, models, schemas, services directories to modules: customers: - exceptions.py, models/, schemas/, services/ inventory: - exceptions.py, models/, schemas/, services/ messaging: - exceptions.py, models/, schemas/, services/ monitoring: - exceptions.py, models/, schemas/, services/ orders: - exceptions.py, models/, schemas/, services/ payments: - Updated __init__.py All modules now have the standard self-contained directory structure ready for future migration of business logic. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
# app/modules/monitoring/exceptions.py
|
|
"""
|
|
Monitoring module exceptions.
|
|
|
|
Module-specific exceptions for monitoring functionality.
|
|
"""
|
|
|
|
from app.exceptions.base import (
|
|
BusinessLogicException,
|
|
ResourceNotFoundException,
|
|
)
|
|
|
|
|
|
class TaskNotFoundException(ResourceNotFoundException):
|
|
"""Raised when a background task is not found."""
|
|
|
|
def __init__(self, task_id: str):
|
|
super().__init__(
|
|
resource_type="BackgroundTask",
|
|
identifier=task_id,
|
|
error_code="TASK_NOT_FOUND",
|
|
)
|
|
|
|
|
|
class CapacitySnapshotNotFoundException(ResourceNotFoundException):
|
|
"""Raised when a capacity snapshot is not found."""
|
|
|
|
def __init__(self, snapshot_id: int):
|
|
super().__init__(
|
|
resource_type="CapacitySnapshot",
|
|
identifier=str(snapshot_id),
|
|
error_code="CAPACITY_SNAPSHOT_NOT_FOUND",
|
|
)
|
|
|
|
|
|
class MonitoringServiceException(BusinessLogicException):
|
|
"""Raised when a monitoring operation fails."""
|
|
|
|
def __init__(self, operation: str, reason: str):
|
|
super().__init__(
|
|
message=f"Monitoring operation '{operation}' failed: {reason}",
|
|
error_code="MONITORING_OPERATION_FAILED",
|
|
)
|
|
|
|
|
|
__all__ = [
|
|
"TaskNotFoundException",
|
|
"CapacitySnapshotNotFoundException",
|
|
"MonitoringServiceException",
|
|
]
|