UvsReason

Enum UvsReason 

Source
pub enum UvsReason {
    ValidationError(String),
    BusinessError(String),
    NotFoundError(String),
    PermissionError(String),
    DataError(String, Option<usize>),
    SystemError(String),
    NetworkError(String),
    ResourceError(String),
    TimeoutError(String),
    ConfigError(ConfErrReason),
    ExternalError(String),
    LogicError(String),
}
Expand description

Universal error reason classification with clear hierarchical structure 统一错误原因分类 - 采用清晰的分层结构

§Error Code Ranges

  • 100-199: Business Layer Errors (业务层错误)
  • 200-299: Infrastructure Layer Errors (基础设施层错误)
  • 300-399: Configuration & External Layer Errors (配置和外部层错误)

§Classification Principles

  • Business Layer: User-facing errors that are expected in normal operation
  • Infrastructure Layer: System-level failures that should be rare
  • Configuration & External: Environment and third-party service issues

Variants§

§

ValidationError(String)

Input validation errors (格式错误、参数校验失败等)

§

BusinessError(String)

Business logic rule violations (业务规则违反、状态冲突等)

§

NotFoundError(String)

Resource not found (查询的资源不存在)

§

PermissionError(String)

Permission and authorization errors (权限不足、认证失败)

§

DataError(String, Option<usize>)

Database and data processing errors (数据库操作、数据格式错误)

§

SystemError(String)

File system and OS-level errors (文件系统、操作系统错误)

§

NetworkError(String)

Network connectivity and protocol errors (网络连接、HTTP请求错误)

§

ResourceError(String)

Resource exhaustion (内存不足、磁盘空间不足等)

§

TimeoutError(String)

Operation timeouts (操作超时)

§

ConfigError(ConfErrReason)

Configuration-related errors (配置相关错误)

§

ExternalError(String)

Third-party service errors (第三方服务错误)

§

LogicError(String)

Third-party service errors (第三方服务错误)

Implementations§

Source§

impl UvsReason

Source

pub fn core_conf<S: Into<String>>(msg: S) -> Self

Source

pub fn feature_conf<S: Into<String>>(msg: S) -> Self

Source

pub fn dynamic_conf<S: Into<String>>(msg: S) -> Self

Source

pub fn validation_error<S: Into<String>>(msg: S) -> Self

Source

pub fn business_error<S: Into<String>>(msg: S) -> Self

Source

pub fn not_found_error<S: Into<String>>(msg: S) -> Self

Source

pub fn permission_error<S: Into<String>>(msg: S) -> Self

Source

pub fn data_error<S: Into<String>>(msg: S, pos: Option<usize>) -> Self

Source

pub fn system_error<S: Into<String>>(msg: S) -> Self

Source

pub fn network_error<S: Into<String>>(msg: S) -> Self

Source

pub fn resource_error<S: Into<String>>(msg: S) -> Self

Source

pub fn timeout_error<S: Into<String>>(msg: S) -> Self

Source

pub fn external_error<S: Into<String>>(msg: S) -> Self

Source

pub fn logic_error<S: Into<String>>(msg: S) -> Self

Source§

impl UvsReason

Source

pub fn is_retryable(&self) -> bool

Check if this error is retryable 检查错误是否可重试

Source

pub fn is_high_severity(&self) -> bool

Check if this error should be logged with high severity 检查错误是否需要高优先级记录

Source

pub fn category_name(&self) -> &'static str

Get error category name for monitoring and metrics 获取错误类别名称用于监控和指标

Trait Implementations§

Source§

impl Clone for UvsReason

Source§

fn clone(&self) -> UvsReason

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UvsReason

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for UvsReason

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for UvsReason

1.30.0 · Source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl ErrorCode for UvsReason

Source§

fn error_code(&self) -> i32

Source§

impl PartialEq for UvsReason

Source§

fn eq(&self, other: &UvsReason) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for UvsReason

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for UvsReason

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<R> ToStructError<R> for R
where R: DomainReason,

Source§

fn to_err(self) -> StructError<R>

Source§

fn err_result<T>(self) -> Result<T, StructError<R>>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UvsBizFrom<&str> for T
where T: From<UvsReason>,

Source§

fn from_biz(info: &str) -> T

Source§

impl<T> UvsBizFrom<String> for T
where T: From<UvsReason>,

Source§

fn from_biz(info: String) -> T

Source§

impl<T> UvsConfFrom<&str> for T
where T: From<UvsReason>,

Source§

fn from_conf(reason: &str) -> T

Source§

impl<T> UvsConfFrom<ConfErrReason> for T
where T: From<UvsReason>,

Source§

impl<T> UvsConfFrom<String> for T
where T: From<UvsReason>,

Source§

fn from_conf(reason: String) -> T

Source§

impl<T> UvsDataFrom<&str> for T
where T: From<UvsReason>,

Source§

fn from_data(info: &str, pos: Option<usize>) -> T

Source§

impl<T> UvsDataFrom<String> for T
where T: From<UvsReason>,

Source§

fn from_data(info: String, pos: Option<usize>) -> T

Source§

impl<T> UvsExternalFrom<&str> for T
where T: From<UvsReason>,

Source§

fn from_external(info: &str) -> T

Source§

impl<T> UvsExternalFrom<String> for T
where T: From<UvsReason>,

Source§

impl<T> UvsLogicFrom<&str> for T
where T: From<UvsReason>,

Source§

fn from_logic(info: &str) -> T

Source§

impl<T> UvsLogicFrom<String> for T
where T: From<UvsReason>,

Source§

fn from_logic(info: String) -> T

Source§

impl<T> UvsNetFrom<&str> for T
where T: From<UvsReason>,

Source§

fn from_net(info: &str) -> T

Source§

impl<T> UvsNetFrom<String> for T
where T: From<UvsReason>,

Source§

fn from_net(info: String) -> T

Source§

impl<T> UvsNotFoundFrom<&str> for T
where T: From<UvsReason>,

Source§

fn from_not_found(info: &str) -> T

Source§

impl<T> UvsNotFoundFrom<String> for T
where T: From<UvsReason>,

Source§

impl<T> UvsPermissionFrom<&str> for T
where T: From<UvsReason>,

Source§

impl<T> UvsPermissionFrom<String> for T
where T: From<UvsReason>,

Source§

impl<T> UvsResFrom<&str> for T
where T: From<UvsReason>,

Source§

fn from_res(info: &str) -> T

Source§

impl<T> UvsResFrom<String> for T
where T: From<UvsReason>,

Source§

fn from_res(info: String) -> T

Source§

impl<T> UvsSysFrom<&str> for T
where T: From<UvsReason>,

Source§

fn from_sys(info: &str) -> T

Source§

impl<T> UvsSysFrom<String> for T
where T: From<UvsReason>,

Source§

fn from_sys(info: String) -> T

Source§

impl<T> UvsTimeoutFrom<&str> for T
where T: From<UvsReason>,

Source§

fn from_timeout(info: &str) -> T

Source§

impl<T> UvsTimeoutFrom<String> for T
where T: From<UvsReason>,

Source§

impl<T> UvsValidationFrom<&str> for T
where T: From<UvsReason>,

Source§

impl<T> UvsValidationFrom<String> for T
where T: From<UvsReason>,

Source§

impl<T> DomainReason for T