src/pqc_reasoning_ledger/errors.py
1.1 KB · 34 lines · python Raw
1 """Exception hierarchy for pqc-reasoning-ledger."""
2
3 from __future__ import annotations
4
5
6 class ReasoningLedgerError(Exception):
7 """Base exception for all pqc-reasoning-ledger errors."""
8
9
10 class ChainBrokenError(ReasoningLedgerError):
11 """Raised when a step's previous_step_hash does not match the current chain tip,
12 or when step ordering/linkage is otherwise inconsistent."""
13
14
15 class StepVerificationError(ReasoningLedgerError):
16 """Raised when a step's declared step_hash does not match its recomputed hash."""
17
18
19 class TraceSealedError(ReasoningLedgerError):
20 """Raised when attempting to append to a trace that has already been sealed."""
21
22
23 class InvalidStepError(ReasoningLedgerError):
24 """Raised when a step is structurally invalid (bad kind, bad confidence, etc.)."""
25
26
27 class StepNotFoundError(ReasoningLedgerError):
28 """Raised when a referenced step_id does not exist in a trace."""
29
30
31 class SignatureVerificationError(ReasoningLedgerError):
32 """Raised when a SealedTrace's ML-DSA signature fails to verify,
33 or a full verification result is not fully_verified."""
34