1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5 #[error("Generic: {0}")]
6 Generic(String),
7 #[error("InvalidData: {0}")]
8 InvalidData(String),
9 #[error("IO: {0}")]
10 IO(String),
11 #[error("KeyMismatch: {0}")]
12 KeyMismatch(String),
13 #[error("Notify: {0}")]
14 Notify(String),
15 #[error("NotFound: {0}")]
16 NotFound(&'static str),
17 #[error("PrivateKey: {0}")]
18 PrivateKey(String),
19}
20
21impl From<std::io::Error> for Error {
22 fn from(err: std::io::Error) -> Self {
23 Self::IO(err.to_string())
24 }
25}
26
27impl From<tokio::task::JoinError> for Error {
28 fn from(err: tokio::task::JoinError) -> Self {
29 Self::Generic(err.to_string())
30 }
31}
32
33impl From<rustls::Error> for Error {
34 fn from(err: rustls::Error) -> Self {
35 Self::Generic(err.to_string())
36 }
37}
38
39impl From<notify::Error> for Error {
40 fn from(err: notify::Error) -> Self {
41 Self::Notify(err.to_string())
42 }
43}