src/pqc_mcp_transport/errors.py
743 B · 28 lines · python Raw
1 """Custom exceptions for PQC MCP Transport."""
2
3 from __future__ import annotations
4
5
6 class PQCTransportError(Exception):
7 """Base exception for all PQC transport errors."""
8
9
10 class SignatureVerificationError(PQCTransportError):
11 """Raised when a PQC signature fails verification."""
12
13
14 class HandshakeError(PQCTransportError):
15 """Raised when the PQC handshake fails."""
16
17
18 class SessionExpiredError(PQCTransportError):
19 """Raised when a PQC session has timed out."""
20
21
22 class ReplayAttackError(PQCTransportError):
23 """Raised when a nonce has already been used (potential replay attack)."""
24
25
26 class PeerNotAuthenticatedError(PQCTransportError):
27 """Raised when an operation requires an authenticated session but none exists."""
28