- Create platform_service.py to move DB queries from platforms.py API - Create platform.py exceptions for PlatformNotFoundException - Update platforms.py API to use platform_service - Update vendor/content_pages.py to use vendor_service - Add get_vendor_by_id_optional method to VendorService - Fix platforms.js: add centralized logger and init guard - Fix content-page-edit.html: use modal macro instead of inline modal All 21 architecture validation errors resolved. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
# app/exceptions/platform.py
|
|
"""
|
|
Platform-related exceptions.
|
|
|
|
Custom exceptions for platform management operations.
|
|
"""
|
|
|
|
from app.exceptions.base import WizamartException
|
|
|
|
|
|
class PlatformNotFoundException(WizamartException):
|
|
"""Raised when a platform is not found."""
|
|
|
|
def __init__(self, code: str):
|
|
super().__init__(
|
|
message=f"Platform not found: {code}",
|
|
error_code="PLATFORM_NOT_FOUND",
|
|
status_code=404,
|
|
details={"platform_code": code},
|
|
)
|
|
|
|
|
|
class PlatformInactiveException(WizamartException):
|
|
"""Raised when trying to access an inactive platform."""
|
|
|
|
def __init__(self, code: str):
|
|
super().__init__(
|
|
message=f"Platform is inactive: {code}",
|
|
error_code="PLATFORM_INACTIVE",
|
|
status_code=403,
|
|
details={"platform_code": code},
|
|
)
|
|
|
|
|
|
class PlatformUpdateException(WizamartException):
|
|
"""Raised when platform update fails."""
|
|
|
|
def __init__(self, code: str, reason: str):
|
|
super().__init__(
|
|
message=f"Failed to update platform {code}: {reason}",
|
|
error_code="PLATFORM_UPDATE_FAILED",
|
|
status_code=400,
|
|
details={"platform_code": code, "reason": reason},
|
|
)
|