1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum HingeError {
5 #[error("http: {0}")]
6 Http(String),
7 #[error("auth: {0}")]
8 Auth(String),
9 #[error("email_2fa required: case_id={case_id} email={email}")]
10 Email2FA { case_id: String, email: String },
11 #[error("storage: {0}")]
12 Storage(String),
13 #[error("serde: {0}")]
14 Serde(String),
15}
16
17impl From<reqwest::Error> for HingeError {
18 fn from(e: reqwest::Error) -> Self {
19 Self::Http(e.to_string())
20 }
21}
22impl From<serde_json::Error> for HingeError {
23 fn from(e: serde_json::Error) -> Self {
24 Self::Serde(e.to_string())
25 }
26}