Some checks failed
- Add complete hosting module (models, routes, schemas, services, templates, migrations) - Add HostWizard platform to init_production seed (code=hosting, domain=hostwizard.lu) - Fix cms_002 migration down_revision to z_unique_subdomain_domain - Fix prospecting_001 migration to chain after cms_002 (remove branch label) - Add hosting/prospecting version_locations to alembic.ini - Fix admin_services delete endpoint to use proper response model - Add hostwizard.lu to deployment docs (DNS, Caddy, Cloudflare) - Add hosting and prospecting user journey docs to mkdocs nav Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
1.6 KiB
Python
58 lines
1.6 KiB
Python
# app/modules/hosting/exceptions.py
|
|
"""
|
|
Hosting module exceptions.
|
|
"""
|
|
|
|
from app.exceptions.base import (
|
|
BusinessLogicException,
|
|
ResourceNotFoundException,
|
|
)
|
|
|
|
|
|
class HostedSiteNotFoundException(ResourceNotFoundException): # noqa: MOD025
|
|
"""Raised when a hosted site is not found."""
|
|
|
|
def __init__(self, identifier: str):
|
|
super().__init__(
|
|
resource_type="HostedSite",
|
|
identifier=identifier,
|
|
)
|
|
|
|
|
|
class ClientServiceNotFoundException(ResourceNotFoundException): # noqa: MOD025
|
|
"""Raised when a client service is not found."""
|
|
|
|
def __init__(self, identifier: str):
|
|
super().__init__(
|
|
resource_type="ClientService",
|
|
identifier=identifier,
|
|
)
|
|
|
|
|
|
class DuplicateSlugException(BusinessLogicException): # noqa: MOD025
|
|
"""Raised when trying to create a site with a slug that already exists."""
|
|
|
|
def __init__(self, slug: str):
|
|
super().__init__(
|
|
message=f"A hosted site with slug '{slug}' already exists",
|
|
error_code="DUPLICATE_SLUG",
|
|
)
|
|
|
|
|
|
class InvalidStatusTransitionException(BusinessLogicException): # noqa: MOD025
|
|
"""Raised when attempting an invalid status transition."""
|
|
|
|
def __init__(self, current_status: str, target_status: str):
|
|
super().__init__(
|
|
message=f"Cannot transition from '{current_status}' to '{target_status}'",
|
|
error_code="INVALID_STATUS_TRANSITION",
|
|
)
|
|
|
|
|
|
__all__ = [
|
|
"HostedSiteNotFoundException",
|
|
"ClientServiceNotFoundException",
|
|
"DuplicateSlugException",
|
|
"InvalidStatusTransitionException",
|
|
]
|