src/pqc_rag_signing/errors.py
| 1 | """Exception hierarchy for pqc-rag-signing.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | |
| 6 | class RAGSigningError(Exception): |
| 7 | """Base exception for all pqc-rag-signing errors.""" |
| 8 | |
| 9 | |
| 10 | class ChunkVerificationError(RAGSigningError): |
| 11 | """Raised when a signed chunk fails cryptographic verification.""" |
| 12 | |
| 13 | |
| 14 | class TamperedChunkError(ChunkVerificationError): |
| 15 | """Raised when chunk content hash doesn't match the signed hash.""" |
| 16 | |
| 17 | |
| 18 | class UnsignedChunkError(RAGSigningError): |
| 19 | """Raised when an unsigned chunk is encountered in a verified pipeline.""" |
| 20 | |
| 21 | |
| 22 | class CorpusIntegrityError(RAGSigningError): |
| 23 | """Raised when the corpus manifest root doesn't match stored chunks.""" |
| 24 | |
| 25 | |
| 26 | class KeyMismatchError(ChunkVerificationError): |
| 27 | """Raised when the chunk signer DID doesn't match the expected signer.""" |
| 28 | |