"""Exception hierarchy for the PMP reference node. Every error raised intentionally by this package derives from :class:`PMPError`, so callers (the CLI, tests, embedding applications) can catch one base class. Subclasses indicate *where* in the stack the failure happened, which matters for a system whose whole point is auditable integrity: a :class:`SignatureError` is a very different event from an :class:`AdapterError`. """ from __future__ import annotations class PMPError(Exception): """Base class for all errors raised by the PMP reference node.""" class CanonicalizationError(PMPError): """A value cannot be represented in canonical JSON form. Raised when a document contains non-finite floats, non-string object keys, or unsupported Python types. Canonical bytes are the basis of every hash and signature, so this is always a programming error in the producer of the document, never recoverable data. """ class KeyStoreError(PMPError): """Key material could not be created, loaded, or parsed.""" class SignatureError(PMPError): """A cryptographic signature is missing, malformed, or invalid.""" class OperationError(PMPError): """An operation is structurally invalid (bad fields, bad body, bad op_id).""" class LogIntegrityError(PMPError): """The append-only log is broken: bad hash chain, bad sequence, or on-disk bytes that do not match their canonical form.""" class AdapterError(PMPError): """An import adapter could not read or parse its source material.""" class NodeError(PMPError): """Node-level configuration or lifecycle failure (init/open/import)."""