core_crypto/e2e_identity/
error.rs

1//! End to end identity errors
2
3// We allow missing documentation in the error module because the types are generally self-descriptive.
4#![allow(missing_docs)]
5
6pub type Result<T, E = Error> = core::result::Result<T, E>;
7
8#[derive(Debug, thiserror::Error)]
9pub enum Error {
10    #[error("Incorrect usage of this API")]
11    ImplementationError,
12    #[error("Not yet supported")]
13    NotYetSupported,
14    #[error("Enrollment methods are called out of order: {0}")]
15    OutOfOrderEnrollment(&'static str),
16    #[error("Invalid OIDC RefreshToken supplied")]
17    InvalidRefreshToken,
18    #[error("The encountered ClientId does not match Wire's definition")]
19    InvalidClientId,
20    #[error("This function accepts a list of IDs as a parameter, but that list was empty")]
21    EmptyInputIdList,
22    #[error("No enrollment was found")]
23    NotFound,
24    #[error(transparent)]
25    IdentityError(#[from] wire_e2e_identity::E2eIdentityError),
26    #[error(transparent)]
27    X509Error(#[from] wire_e2e_identity::x509_check::RustyX509CheckError),
28    #[error(transparent)]
29    UrlError(#[from] url::ParseError),
30    #[error(transparent)]
31    JsonError(#[from] serde_json::Error),
32    #[error(transparent)]
33    X509CertDerError(#[from] x509_cert::der::Error),
34    #[error("Serializing key package for TLS")]
35    TlsSerializingKeyPackage(#[from] tls_codec::Error),
36    #[error("{context}: {upstream}")]
37    CertificateValidation {
38        context: &'static str,
39        // We the programmer know that this error type comes from the `certval` crate,
40        // but that is not in scope at this point and doesn't implement `std::error::Error`,
41        // so ¯\_(ツ)_/¯
42        upstream: String,
43    },
44    #[error(transparent)]
45    Mls(#[from] crate::MlsError),
46    #[error(transparent)]
47    Keystore(#[from] crate::KeystoreError),
48    #[error("{0}")]
49    Leaf(#[from] crate::LeafError),
50    #[error(transparent)]
51    Recursive(#[from] crate::RecursiveError),
52}