src/pqc_gpu_driver/errors.py
| 1 | """Exception hierarchy for pqc-gpu-driver.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | |
| 6 | class GPUDriverError(Exception): |
| 7 | """Base exception for all pqc-gpu-driver errors.""" |
| 8 | |
| 9 | |
| 10 | class ChannelEstablishmentError(GPUDriverError): |
| 11 | """Raised when the CPU<->GPU encrypted channel cannot be established.""" |
| 12 | |
| 13 | |
| 14 | class ChannelExpiredError(GPUDriverError): |
| 15 | """Raised when an operation is attempted on an expired ChannelSession.""" |
| 16 | |
| 17 | |
| 18 | class NonceReplayError(GPUDriverError): |
| 19 | """Raised when a replayed sequence number or nonce is detected.""" |
| 20 | |
| 21 | |
| 22 | class DecryptionError(GPUDriverError): |
| 23 | """Raised when an EncryptedTensor fails AES-GCM decryption or AAD check.""" |
| 24 | |
| 25 | |
| 26 | class DriverAttestationError(GPUDriverError): |
| 27 | """Raised when a DriverAttestation fails signature / hash / trust verification.""" |
| 28 | |
| 29 | |
| 30 | class BackendError(GPUDriverError): |
| 31 | """Raised when a GPU backend encounters an unrecoverable error |
| 32 | (e.g. missing runtime, unsupported operation, stub invoked).""" |
| 33 | |