src/pqc_mbom/errors.py
| 1 | """Exception hierarchy for pqc-mbom.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | |
| 6 | class MBOMError(Exception): |
| 7 | """Base exception for all pqc-mbom errors.""" |
| 8 | |
| 9 | |
| 10 | class InvalidMBOMError(MBOMError): |
| 11 | """Raised when an MBOM document is malformed or missing required fields.""" |
| 12 | |
| 13 | |
| 14 | class SignatureVerificationError(MBOMError): |
| 15 | """Raised when an MBOM signature fails cryptographic verification.""" |
| 16 | |
| 17 | |
| 18 | class ComponentError(MBOMError): |
| 19 | """Raised when a ModelComponent is invalid or internally inconsistent.""" |
| 20 | |
| 21 | |
| 22 | class MissingComponentError(ComponentError): |
| 23 | """Raised when a referenced component is not present in the MBOM.""" |
| 24 | |
| 25 | |
| 26 | class SPDXConversionError(MBOMError): |
| 27 | """Raised when converting between MBOM and SPDX fails a schema check.""" |
| 28 | |