Debian Codegraph @

third_party/rust/ohttp/src/err.rs

raw
1 use thiserror::Error;
2
3 #[derive(Error, Debug)]
4 pub enum Error {
5 #[cfg(feature = "rust-hpke")]
6 #[error("a problem occurred with the AEAD")]
7 Aead(#[from] aead::Error),
8 #[cfg(feature = "nss")]
9 #[error("a problem occurred during cryptographic processing: {0}")]
10 Crypto(#[from] crate::nss::Error),
11 #[error("an error was found in the format")]
12 Format,
13 #[cfg(all(feature = "rust-hpke", not(feature = "pq")))]
14 #[error("a problem occurred with HPKE: {0}")]
15 Hpke(#[from] ::hpke::HpkeError),
16 #[cfg(all(feature = "rust-hpke", feature = "pq"))]
17 #[error("a problem occurred with HPKE: {0}")]
18 Hpke(#[from] ::hpke_pq::HpkeError),
19 #[error("an internal error occurred")]
20 Internal,
21 #[error("the wrong type of key was provided for the selected KEM")]
22 InvalidKeyType,
23 #[error("the wrong KEM was specified")]
24 InvalidKem,
25 #[error("io error: {0}")]
26 Io(#[from] std::io::Error),
27 #[error("the key ID was invalid")]
28 KeyId,
29 #[error("a field was truncated")]
30 Truncated,
31 #[error("the configuration was not supported")]
32 Unsupported,
33 #[error("the configuration contained too many symmetric suites")]
34 TooManySymmetricSuites,
35 }
36
37 impl From<std::num::TryFromIntError> for Error {
38 fn from(_v: std::num::TryFromIntError) -> Self {
39 Self::TooManySymmetricSuites
40 }
41 }
42
43 pub type Res<T> = Result<T, Error>;