pub enum WxPayError {
Show 33 variants
ConfigError {
message: String,
},
InvalidPrivateKey(String),
InvalidCertificate(String),
MissingConfig {
field: String,
},
SignError(String),
SignatureVerificationFailed,
InvalidSignatureFormat(String),
EncryptionError(String),
DecryptionError(String),
InvalidKey(String),
InvalidCiphertext(String),
CertificateDownloadError(String),
CertificateParseError(String),
CertificateExpired,
CertificateVerificationError(String),
CertificateNotFound(String),
NetworkError(Error),
RequestBuildError(String),
ResponseParseError(String),
Timeout,
ApiError {
code: String,
message: String,
},
UnexpectedStatusCode(u16),
BusinessError(String),
NotifySignatureVerificationFailed,
NotifyDecryptionError(String),
InvalidNotifyFormat(String),
InvalidNotifyType(String),
JsonError(Error),
UrlEncodeError(String),
UrlParseError(ParseError),
InternalError(String),
UnsupportedOperation(String),
InvalidParameter(String),
}Expand description
微信支付 SDK 错误类型
Variants§
ConfigError
配置错误
InvalidPrivateKey(String)
无效的私钥
InvalidCertificate(String)
无效的证书
MissingConfig
缺少必填配置项
SignError(String)
签名生成失败
SignatureVerificationFailed
签名验证失败
InvalidSignatureFormat(String)
无效的签名格式
EncryptionError(String)
加密失败
DecryptionError(String)
解密失败
InvalidKey(String)
无效的密钥
InvalidCiphertext(String)
无效的密文格式
CertificateDownloadError(String)
证书下载失败
CertificateParseError(String)
证书解析失败
CertificateExpired
证书已过期
CertificateVerificationError(String)
证书验证失败
CertificateNotFound(String)
找不到匹配的证书
NetworkError(Error)
网络错误
RequestBuildError(String)
HTTP 请求构建失败
ResponseParseError(String)
HTTP 响应解析失败
Timeout
请求超时
ApiError
微信支付 API 错误
UnexpectedStatusCode(u16)
API 返回了意外的状态码
BusinessError(String)
业务逻辑错误
NotifySignatureVerificationFailed
通知签名验证失败
NotifyDecryptionError(String)
通知解密失败
InvalidNotifyFormat(String)
无效的通知格式
InvalidNotifyType(String)
无效的通知类型
JsonError(Error)
JSON 序列化/反序列化错误
UrlEncodeError(String)
URL 编码错误
UrlParseError(ParseError)
URL 解析错误
InternalError(String)
内部错误
UnsupportedOperation(String)
不支持的操作
InvalidParameter(String)
参数错误
Implementations§
Source§impl WxPayError
impl WxPayError
Sourcepub fn missing_config(field: impl Into<String>) -> Self
pub fn missing_config(field: impl Into<String>) -> Self
创建缺少配置项错误
Sourcepub fn encryption(message: impl Into<String>) -> Self
pub fn encryption(message: impl Into<String>) -> Self
创建加密错误
Sourcepub fn decryption(message: impl Into<String>) -> Self
pub fn decryption(message: impl Into<String>) -> Self
创建解密错误
Sourcepub fn certificate_parse(message: impl Into<String>) -> Self
pub fn certificate_parse(message: impl Into<String>) -> Self
创建证书错误
Sourcepub fn certificate_download(message: impl Into<String>) -> Self
pub fn certificate_download(message: impl Into<String>) -> Self
创建证书下载错误
Sourcepub fn certificate_verification(message: impl Into<String>) -> Self
pub fn certificate_verification(message: impl Into<String>) -> Self
创建证书验证错误
Sourcepub fn invalid_parameter(message: impl Into<String>) -> Self
pub fn invalid_parameter(message: impl Into<String>) -> Self
创建参数错误
Sourcepub fn api_kind(&self) -> Option<WxPayErrorKind>
pub fn api_kind(&self) -> Option<WxPayErrorKind>
获取 API 错误分类
Sourcepub fn alert_level(&self) -> WxPayAlertLevel
pub fn alert_level(&self) -> WxPayAlertLevel
告警级别(用于结构化日志告警策略)
Sourcepub fn alert_policy(&self) -> &'static str
pub fn alert_policy(&self) -> &'static str
告警策略键(用于指标/告警策略路由)
Sourcepub fn should_retry(&self) -> bool
pub fn should_retry(&self) -> bool
是否建议重试
Sourcepub fn is_network_error(&self) -> bool
pub fn is_network_error(&self) -> bool
判断是否为网络错误
Sourcepub fn is_api_error(&self) -> bool
pub fn is_api_error(&self) -> bool
判断是否为 API 错误
Sourcepub fn is_auth_error(&self) -> bool
pub fn is_auth_error(&self) -> bool
判断是否为鉴权相关错误
Sourcepub fn is_signature_error(&self) -> bool
pub fn is_signature_error(&self) -> bool
判断是否为签名/验签错误
Sourcepub fn is_certificate_error(&self) -> bool
pub fn is_certificate_error(&self) -> bool
判断是否为证书错误
Trait Implementations§
Source§impl Debug for WxPayError
impl Debug for WxPayError
Source§impl Display for WxPayError
impl Display for WxPayError
Source§impl Error for WxPayError
impl Error for WxPayError
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<DecodeError> for WxPayError
从 base64 错误转换
impl From<DecodeError> for WxPayError
从 base64 错误转换
Source§fn from(err: DecodeError) -> Self
fn from(err: DecodeError) -> Self
Converts to this type from the input type.
Source§impl From<Error> for WxPayError
impl From<Error> for WxPayError
Source§impl From<Error> for WxPayError
impl From<Error> for WxPayError
Source§impl From<Error> for WxPayError
从 RSA 错误转换
impl From<Error> for WxPayError
从 RSA 错误转换
Source§impl From<Error> for WxPayError
从 PKCS 错误转换
impl From<Error> for WxPayError
从 PKCS 错误转换
Source§impl From<Error> for WxPayError
从 DER 错误转换
impl From<Error> for WxPayError
从 DER 错误转换
Source§impl From<ParseError> for WxPayError
impl From<ParseError> for WxPayError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Converts to this type from the input type.
Source§impl From<ParseError> for WxPayError
从时间解析错误转换
impl From<ParseError> for WxPayError
从时间解析错误转换
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for WxPayError
impl !UnwindSafe for WxPayError
impl Freeze for WxPayError
impl Send for WxPayError
impl Sync for WxPayError
impl Unpin for WxPayError
impl UnsafeUnpin for WxPayError
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more