pub enum Error {
Channel(String),
Conversion(String),
Validation(String),
Config(String),
Connection(String),
Timeout(String),
Other(String),
}Expand description
RMS 错误类型
这个枚举定义了 RMS 系统中可能出现的所有错误类型。 每种错误类型都包含详细的错误信息,以帮助定位和解决问题。
Variants§
Channel(String)
消息通道相关错误
当消息的发送、接收或通道操作出现问题时返回此错误。
Conversion(String)
消息转换错误
当消息在不同格式之间转换失败时返回此错误。
Validation(String)
消息验证错误
当消息不满足验证规则时返回此错误。
Config(String)
配置错误
当系统配置无效或缺失时返回此错误。
Connection(String)
连接错误
当与消息中间件的连接出现问题时返回此错误。
Timeout(String)
超时错误
当操作超过指定时间限制时返回此错误。
Other(String)
其他错误
不属于上述类别的其他错误。
Implementations§
Source§impl Error
impl Error
Sourcepub fn conversion<T: Display>(err: T) -> Self
pub fn conversion<T: Display>(err: T) -> Self
创建转换错误
Sourcepub fn validation<T: Display>(err: T) -> Self
pub fn validation<T: Display>(err: T) -> Self
创建验证错误
Sourcepub fn connection<T: Display>(err: T) -> Self
pub fn connection<T: Display>(err: T) -> Self
创建连接错误
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
判断错误是否为超时错误
Sourcepub fn is_connection_error(&self) -> bool
pub fn is_connection_error(&self) -> bool
判断错误是否为连接错误
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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 From<KafkaError> for Error
impl From<KafkaError> for Error
Source§fn from(err: KafkaError) -> Self
fn from(err: KafkaError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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