siwa_async/common/
error.rs1use thiserror::Error;
4
5use crate::object::AuthError;
6
7#[derive(Error, Debug)]
8pub enum Error {
9 #[error("Header algorithm unspecified")]
10 HeaderAlgorithmUnspecified,
11 #[error("Apple Keys Error")]
12 AppleKeys,
13 #[error("Key ID not found")]
14 KidNotFound,
15 #[error("Key not found")]
16 KeyNotFound,
17 #[error("Iss claim mismatch")]
18 IssClaimMismatch,
19 #[error("Client ID mismatch")]
20 ClientIdMismatch,
21 #[error(transparent)]
22 Jwt(#[from] jsonwebtoken::errors::Error),
23 #[error("serde_json error: {0}")]
24 SerdeJson(#[from] serde_json::Error),
25 #[error("hyper error: {0}")]
26 Hyper(#[from] hyper::Error),
27 #[error("http error: {0}")]
28 Http(#[from] hyper::http::Error),
29 #[error("Time error")]
30 SystemTime,
31 #[error("Token Sign Failed")]
32 SignWithKey,
33 #[error("Auth Validation HTTP request failed: {0}")]
34 HttpError(String),
35 #[error("Bad Auth Validation Request: {0}")]
36 BadRequest(#[from] AuthError),
37 #[error("Reqwest error: {0}")]
38 ReqwestClient(#[from] reqwest::Error),
39 #[error("PKEY error: {0}")]
40 PkeyCreation(#[from] openssl::error::ErrorStack),
41}
42
43pub type Result<T> = std::result::Result<T, Error>;