use thiserror::Error; #[derive(Error, Debug)] pub enum Error { #[cfg(feature = "rust-hpke")] #[error("a problem occurred with the AEAD")] Aead(#[from] aead::Error), #[cfg(feature = "nss")] #[error("a problem occurred during cryptographic processing: {0}")] Crypto(#[from] crate::nss::Error), #[error("an error was found in the format")] Format, #[error("a problem occurred with HPKE: {0}")] #[cfg(feature = "rust-hpke")] Hpke(#[from] ::hpke::HpkeError), #[error("an internal error occurred")] Internal, #[error("the wrong type of key was provided for the selected KEM")] InvalidKeyType, #[error("the wrong KEM was specified")] InvalidKem, #[error("io error: {0}")] Io(#[from] std::io::Error), #[error("the key ID was invalid")] KeyId, #[error("a field was truncated")] Truncated, #[error("the configuration was not supported")] Unsupported, #[error("the configuration contained too many symmetric suites")] TooManySymmetricSuites, } impl From for Error { fn from(_v: std::num::TryFromIntError) -> Self { Self::TooManySymmetricSuites } } pub type Res = Result;