Files
Aegis/backend/app/domain/exceptions.py
Kitos 611e10620e
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
refactor(domain): introduce domain exceptions boundary
- Create domain/errors.py as canonical error hierarchy: DomainError, InvalidStateTransition, PermissionViolation, BusinessRuleViolation, EntityNotFoundError, DuplicateEntityError

- InvalidOperationError now inherits from BusinessRuleViolation for semantic consistency

- Convert domain/exceptions.py to backward-compatible re-export shim with legacy aliases (DomainException, InvalidTransitionError, AuthorizationError)

- Update error_handler.py to import from domain/errors.py and map all new error types

- Update main.py to register DomainError (new base) as the exception handler root
2026-02-18 13:44:47 +01:00

23 lines
677 B
Python

"""Backward-compatible re-exports from :mod:`app.domain.errors`.
All domain errors now live in ``errors.py``. This module preserves the
old import paths so that existing code keeps working without changes::
from app.domain.exceptions import InvalidTransitionError # still works
"""
from app.domain.errors import ( # noqa: F401
BusinessRuleViolation,
DomainError,
DuplicateEntityError,
EntityNotFoundError,
InvalidOperationError,
InvalidStateTransition,
PermissionViolation,
)
# Legacy aliases — old name → new name
DomainException = DomainError
InvalidTransitionError = InvalidStateTransition
AuthorizationError = PermissionViolation