pub enum CliError {
Io(Error),
Json(Error),
Wal(WalError),
RulesDirNotFound(String),
NoRulesFound(String),
InvalidPayload(String),
FactLogParse {
line: usize,
reason: String,
},
HashChain(String),
Other(String),
}Expand description
CLI 错误
设计原则:
- 每个变体携带足够上下文(路径、行号、原因),便于用户定位问题
#[from]自动转换 std::io::Error / serde_json::Error / WalError- Display 输出人类可读的中文/英文混合消息(与现有 CLI 风格一致)
Variants§
Io(Error)
文件系统 I/O 错误
Json(Error)
JSON 序列化/反序列化错误
Wal(WalError)
tier1 WAL 序列化错误(fact_from_json 失败等)
RulesDirNotFound(String)
规则目录不存在
NoRulesFound(String)
规则目录中无 .json 文件
InvalidPayload(String)
初始 payload JSON 解析失败
FactLogParse
fact log 解析错误(指定行号和原因)
HashChain(String)
哈希链验证失败
Other(String)
通用错误(兜底)
Implementations§
Trait Implementations§
Source§impl Error for CliError
impl Error for CliError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for CliError
impl !UnwindSafe for CliError
impl Freeze for CliError
impl Send for CliError
impl Sync for CliError
impl Unpin for CliError
impl UnsafeUnpin for CliError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more