pub enum ErrorSeverity {
Info,
Warning,
Error,
Critical,
}Expand description
错误严重程度
用于对错误进行分级,帮助确定错误处理策略和用户提示方式。
§使用场景
- Info: 信息性消息,通常不需要特殊处理
- Warning: 警告信息,可能影响功能但不阻断操作
- Error: 错误信息,导致操作失败但系统可恢复
- Critical: 严重错误,可能导致系统不稳定
§示例
use open_lark::core::error::ErrorSeverity;
fn log_error(severity: ErrorSeverity, message: &str) {
match severity {
ErrorSeverity::Info => println!("ℹ️ {}", message),
ErrorSeverity::Warning => println!("⚠️ {}", message),
ErrorSeverity::Error => eprintln!("❌ {}", message),
ErrorSeverity::Critical => eprintln!("🚨 CRITICAL: {}", message),
}
}Variants§
Info
信息级别 - 一般性提示信息
Warning
警告级别 - 可能的问题但不影响核心功能
Error
错误级别 - 操作失败但系统可恢复
Critical
严重错误级别 - 可能影响系统稳定性
Trait Implementations§
Source§impl Clone for ErrorSeverity
impl Clone for ErrorSeverity
Source§fn clone(&self) -> ErrorSeverity
fn clone(&self) -> ErrorSeverity
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ErrorSeverity
impl Debug for ErrorSeverity
Source§impl Hash for ErrorSeverity
impl Hash for ErrorSeverity
Source§impl PartialEq for ErrorSeverity
impl PartialEq for ErrorSeverity
impl Copy for ErrorSeverity
impl Eq for ErrorSeverity
impl StructuralPartialEq for ErrorSeverity
Auto Trait Implementations§
impl Freeze for ErrorSeverity
impl RefUnwindSafe for ErrorSeverity
impl Send for ErrorSeverity
impl Sync for ErrorSeverity
impl Unpin for ErrorSeverity
impl UnwindSafe for ErrorSeverity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.