pub enum CoreError {
QuotaExceeded {
resource: &'static str,
limit: u64,
requested: u64,
},
ResourceNotFound {
id: u64,
resource_type: &'static str,
},
ResourceAlreadyExists {
id: u64,
resource_type: &'static str,
},
ResourcePoisoned {
id: u64,
reason: String,
},
OwnershipViolation {
expected: &'static str,
actual: &'static str,
},
InvalidAddressRange {
addr: u64,
len: u64,
max: u64,
},
ArithmeticOverflow {
op: &'static str,
a: u64,
b: u64,
},
StateConflict {
current: String,
expected: String,
},
InvalidConfig {
field: &'static str,
reason: &'static str,
},
Internal(String),
Unknown(String),
}Expand description
核心错误类型
Variants§
QuotaExceeded
资源配额超限
ResourceNotFound
资源未找到
ResourceAlreadyExists
资源已存在(重复创建)
ResourcePoisoned
资源已损坏
OwnershipViolation
所有权错误
InvalidAddressRange
地址范围无效
ArithmeticOverflow
算术溢出
StateConflict
状态冲突
InvalidConfig
无效配置
Internal(String)
内部错误
Unknown(String)
未知错误
Implementations§
Source§impl CoreError
impl CoreError
Sourcepub fn quota_exceeded(
resource: &'static str,
limit: u64,
requested: u64,
) -> CoreError
pub fn quota_exceeded( resource: &'static str, limit: u64, requested: u64, ) -> CoreError
创建配额超限错误
Sourcepub fn resource_not_found(id: u64, resource_type: &'static str) -> CoreError
pub fn resource_not_found(id: u64, resource_type: &'static str) -> CoreError
创建资源未找到错误
Sourcepub fn resource_already_exists(
id: u64,
resource_type: &'static str,
) -> CoreError
pub fn resource_already_exists( id: u64, resource_type: &'static str, ) -> CoreError
创建资源已存在错误
Sourcepub fn ownership_violation(
expected: &'static str,
actual: &'static str,
) -> CoreError
pub fn ownership_violation( expected: &'static str, actual: &'static str, ) -> CoreError
创建所有权违规错误
Sourcepub fn state_conflict(
current: impl Into<String>,
expected: impl Into<String>,
) -> CoreError
pub fn state_conflict( current: impl Into<String>, expected: impl Into<String>, ) -> CoreError
创建状态冲突错误
Sourcepub fn invalid_config(field: &'static str, reason: &'static str) -> CoreError
pub fn invalid_config(field: &'static str, reason: &'static str) -> CoreError
创建无效配置错误
Trait Implementations§
Source§impl Error for CoreError
impl Error for CoreError
1.30.0 · 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()
Source§impl LoggableError for CoreError
impl LoggableError for CoreError
Source§fn is_recoverable(&self) -> bool
fn is_recoverable(&self) -> bool
是否为可恢复错误
是否为安全相关错误
Source§fn severity(&self) -> ErrorSeverity
fn severity(&self) -> ErrorSeverity
获取错误严重级别
Auto Trait Implementations§
impl Freeze for CoreError
impl RefUnwindSafe for CoreError
impl Send for CoreError
impl Sync for CoreError
impl Unpin for CoreError
impl UnsafeUnpin for CoreError
impl UnwindSafe for CoreError
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