from __future__ import annotations class ContentValidationError(Exception): """Base exception for persisted-content/publish validation failures.""" class ContentNotFoundError(ContentValidationError): pass class ContentDefinitionSetError(ContentValidationError): pass class RequiredAttributeMissingError(ContentValidationError): pass class ContentAttributeHierarchyError(ContentValidationError): pass class PublishValidationError(ContentValidationError): pass class RepositoryError(Exception): pass class ContentContractError(Exception): """Base exception for presentation contract and server-side search failures.""" class TemplateNotFoundError(ContentContractError): def __init__(self, template_code: str) -> None: super().__init__(f"Template {template_code!r} was not found") self.template_code = template_code class AmbiguousTemplateCodeError(ContentContractError): def __init__(self, template_code: str, matches: list[str]) -> None: super().__init__(f"Template code {template_code!r} is ambiguous: {matches!r}") self.template_code = template_code self.matches = matches class PresentationContractNotFoundError(ContentContractError): def __init__(self, template_code: str, client_type: str) -> None: super().__init__( f"No active {client_type!r} presentation contract exists for template {template_code!r}" ) self.template_code = template_code self.client_type = client_type class InvalidPresentationContractError(ContentContractError): pass class ModuleNotFoundError(ContentContractError): pass class ModuleIdentityConflictError(ContentContractError): pass class TemplateNotInModuleError(ContentContractError): pass class TemplateNotCollectionError(ContentContractError): pass class InvalidSearchFieldError(ContentContractError): pass class InvalidSearchOperatorError(ContentContractError): pass class InvalidSearchValueError(ContentContractError): pass class InvalidSortFieldError(ContentContractError): pass class ContentProjectionError(ContentContractError): pass class ContentReferenceResolutionError(ContentContractError): """Persisted content_ref cannot be resolved deterministically."""