ilm feature add

This commit is contained in:
likewu
2025-06-22 23:04:40 +08:00
parent 8452c11e9a
commit cc71f40a6d
93 changed files with 12534 additions and 100 deletions
+33
View File
@@ -0,0 +1,33 @@
use http::status::StatusCode;
use std::fmt::{self, Display, Formatter};
#[derive(Default, thiserror::Error, Debug, PartialEq)]
pub struct AdminError {
pub code: &'static str,
pub message: &'static str,
pub status_code: StatusCode,
}
impl Display for AdminError {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "{}", self.message)
}
}
impl AdminError {
pub fn new(code: &'static str, message: &'static str, status_code: StatusCode) -> Self {
Self {
code,
message,
status_code,
}
}
pub fn msg(message: &'static str) -> Self {
Self {
code: "InternalError",
message,
status_code: StatusCode::INTERNAL_SERVER_ERROR,
}
}
}