Skip to main content

web_eid/
error.rs

1/// An error from a Web eID operation.
2#[derive(Debug, thiserror::Error)]
3pub enum WebEidError {
4    /// The origin is not `https://host[:port]` without a trailing slash.
5    #[error("invalid origin {0:?}: expected https://host[:port] without a trailing slash")]
6    InvalidOrigin(String),
7
8    /// An ID card operation failed.
9    #[error(transparent)]
10    Card(#[from] esteid_cryptoki::EstEidError),
11
12    /// A PKCS#11 key operation failed.
13    #[error(transparent)]
14    Token(#[from] tokenkey::TokenkeyError),
15
16    /// Serializing the authentication token failed.
17    #[error("failed to serialize the authentication token: {0}")]
18    Json(#[from] serde_json::Error),
19}
20
21pub type Result<T> = std::result::Result<T, WebEidError>;