Ledgerly/ledgerly/errors.py
2026-10-27 11:04:50 -05:00

25 lines
729 B
Python

"""Application error hierarchy.
Every expected failure is a subclass of :class:`LedgerlyError`, so the CLI
layer can translate failures into stable exit codes instead of inspecting
message text (single source of truth for error semantics).
"""
__all__ = ["ConflictError", "LedgerlyError", "NotFoundError", "ValidationError"]
class LedgerlyError(Exception):
"""Base class for all expected Ledgerly failures."""
class ValidationError(LedgerlyError):
"""Input does not satisfy a domain rule (R1-R10)."""
class NotFoundError(LedgerlyError):
"""The requested entity does not exist (R8, R12)."""
class ConflictError(LedgerlyError):
"""The request conflicts with current state (e.g. a category in use, R9)."""