feat: event management and websocket for updates
This commit is contained in:
@@ -10,7 +10,10 @@ pub enum Error {
|
||||
Pbkdf2(pbkdf2::password_hash::errors::Error),
|
||||
#[cfg(feature = "ssr")]
|
||||
Io(std::io::Error),
|
||||
#[cfg(feature = "ssr")]
|
||||
Axum(axum::Error),
|
||||
AddrParse(std::net::AddrParseError),
|
||||
Json(serde_json::Error),
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Error {
|
||||
@@ -41,6 +44,13 @@ impl std::fmt::Display for Error {
|
||||
Error::AddrParse(err) => {
|
||||
write!(f, "ip address parse error: {err:?}")
|
||||
}
|
||||
Error::Json(err) => {
|
||||
write!(f, "json encode/decode error: {err:?}")
|
||||
}
|
||||
#[cfg(feature = "ssr")]
|
||||
Error::Axum(err) => {
|
||||
write!(f, "axum error: {err:?}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,6 +65,9 @@ impl std::error::Error for Error {
|
||||
#[cfg(feature = "ssr")]
|
||||
Error::Io(err) => Some(err),
|
||||
Error::AddrParse(err) => Some(err),
|
||||
Error::Json(err) => Some(err),
|
||||
#[cfg(feature = "ssr")]
|
||||
Error::Axum(err) => Some(err),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -112,3 +125,16 @@ impl From<std::net::AddrParseError> for Error {
|
||||
Self::AddrParse(err)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<serde_json::Error> for Error {
|
||||
fn from(err: serde_json::Error) -> Self {
|
||||
Self::Json(err)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "ssr")]
|
||||
impl From<axum::Error> for Error {
|
||||
fn from(err: axum::Error) -> Self {
|
||||
Self::Axum(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user