mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-10 23:26:53 +00:00
ilm feature add
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user