Files
orion/app/modules/analytics/exceptions.py
Samir Boulahtit bd2c99a775 feat: complete analytics module self-containment
Migrate analytics module to fully self-contained structure:

- routes/api/vendor.py - API endpoints
- routes/pages/vendor.py - Page routes with full implementation
- services/stats_service.py - Business logic (moved from app/services)
- services/usage_service.py - Usage tracking (moved from app/services)
- schemas/stats.py - Pydantic schemas (moved from models/schema)
- models/__init__.py - Model exports
- templates/analytics/vendor/ - Templates (moved from app/templates)
- static/vendor/js/ - JavaScript (moved from static/vendor)
- locales/ - Translations (en, de, fr, lu)
- exceptions.py - Module exceptions

Removed legacy files:
- app/modules/analytics/routes/vendor.py (replaced by routes/pages/)
- static/admin/js/analytics.js (unused)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:21:21 +01:00

40 lines
1.0 KiB
Python

# app/modules/analytics/exceptions.py
"""
Analytics module exceptions.
Module-specific exceptions for analytics functionality.
"""
from app.exceptions.base import (
BusinessLogicException,
ValidationException,
)
class ReportGenerationException(BusinessLogicException):
"""Raised when report generation fails."""
def __init__(self, report_type: str, reason: str):
super().__init__(
message=f"Failed to generate {report_type} report: {reason}",
error_code="REPORT_GENERATION_FAILED",
)
class InvalidDateRangeException(ValidationException):
"""Raised when an invalid date range is provided."""
def __init__(self, start_date: str, end_date: str):
super().__init__(
message=f"Invalid date range: {start_date} to {end_date}",
field="date_range",
value=f"{start_date} - {end_date}",
)
self.error_code = "INVALID_DATE_RANGE"
__all__ = [
"ReportGenerationException",
"InvalidDateRangeException",
]