//! 配置层错误类型(中文,不含密钥明文) use std::fmt; #[derive(Debug)] pub enum ConfigError { Io(String), Parse(String), /// 不支持的配置格式(本波未实现) Unsupported(String), /// 字段路径非法 InvalidPath(String), } impl fmt::Display for ConfigError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { ConfigError::Io(m) => write!(f, "IO: {m}"), ConfigError::Parse(m) => write!(f, "解析失败: {m}"), ConfigError::Unsupported(m) => write!(f, "不支持: {m}"), ConfigError::InvalidPath(m) => write!(f, "路径非法: {m}"), } } } impl std::error::Error for ConfigError {}