mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-05 12:57:42 +00:00
a0e37098bb
Signed-off-by: junxiang Mu <1948535941@qq.com>
26 lines
542 B
Rust
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
|
|
}
|
|
}
|