Files
rustfs/ecstore/src/config/error.rs
T
junxiang Mu a0e37098bb fix clippy
Signed-off-by: junxiang Mu <1948535941@qq.com>
2024-10-12 14:09:52 +08:00

26 lines
542 B
Rust

use crate::error::Error;
#[derive(Debug, thiserror::Error)]
pub enum ConfigError {
#[error("config not found")]
NotFound,
}
impl ConfigError {
/// Returns `true` if the config error is [`NotFound`].
///
/// [`NotFound`]: ConfigError::NotFound
#[must_use]
pub fn is_not_found(&self) -> bool {
matches!(self, Self::NotFound)
}
}
pub fn is_not_found(err: &Error) -> bool {
if let Some(e) = err.downcast_ref::<ConfigError>() {
ConfigError::is_not_found(e)
} else {
false
}
}