pub enum WeChatError {
Show 15 variants
Network {
message: String,
},
Timeout,
InvalidToken,
InvalidCredentials,
FileNotFound {
path: String,
},
FileRead {
path: String,
reason: String,
},
MarkdownParse {
reason: String,
},
ImageUpload {
path: String,
reason: String,
},
ThemeNotFound {
theme: String,
},
ThemeRender {
theme: String,
reason: String,
},
WeChatApi {
code: i32,
message: String,
},
Config {
message: String,
},
Json {
message: String,
},
Io {
message: String,
},
Internal {
message: String,
},
}
Expand description
Comprehensive error type for WeChat SDK operations.
Variants§
Network
Network-related errors (retryable)
Timeout
Request timeout (retryable)
InvalidToken
Authentication errors (may be retryable once)
InvalidCredentials
FileNotFound
File system errors (not retryable)
FileRead
MarkdownParse
Markdown processing errors (not retryable)
ImageUpload
Image processing errors (may be retryable)
ThemeNotFound
Theme system errors (not retryable)
ThemeRender
WeChatApi
WeChat API errors (retryability depends on error code)
Config
Configuration errors (not retryable)
Json
JSON serialization/deserialization errors
Io
I/O errors
Internal
Generic errors for wrapping other error types
Implementations§
Source§impl WeChatError
impl WeChatError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Determines if an error is retryable.
Network errors, timeouts, and certain WeChat API errors are retryable. Authentication errors are retryable once (token might be expired). File system, parsing, and configuration errors are not retryable.
Sourcepub fn severity(&self) -> ErrorSeverity
pub fn severity(&self) -> ErrorSeverity
Gets the severity level of the error for logging purposes.
Sourcepub fn from_api_response(code: i32, message: impl Into<String>) -> Self
pub fn from_api_response(code: i32, message: impl Into<String>) -> Self
Creates a WeChat API error from response data.
Sourcepub fn file_error(path: impl Into<String>, reason: impl Into<String>) -> Self
pub fn file_error(path: impl Into<String>, reason: impl Into<String>) -> Self
Creates a file-related error.
Sourcepub fn config_error(message: impl Into<String>) -> Self
pub fn config_error(message: impl Into<String>) -> Self
Creates a configuration error.
Sourcepub fn retry_delay(&self) -> Duration
pub fn retry_delay(&self) -> Duration
Gets the recommended retry delay for this error type.
Sourcepub fn max_retries(&self) -> u32
pub fn max_retries(&self) -> u32
Gets the maximum number of retry attempts for this error type.
Sourcepub fn is_temporary(&self) -> bool
pub fn is_temporary(&self) -> bool
Determines if this error indicates a temporary service issue.
Sourcepub fn recovery_suggestion(&self) -> Option<&'static str>
pub fn recovery_suggestion(&self) -> Option<&'static str>
Gets recovery suggestions for this error.
Trait Implementations§
Source§impl Clone for WeChatError
impl Clone for WeChatError
Source§fn clone(&self) -> WeChatError
fn clone(&self) -> WeChatError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for WeChatError
impl Debug for WeChatError
Source§impl Display for WeChatError
impl Display for WeChatError
Source§impl Error for WeChatError
impl Error for WeChatError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Error> for WeChatError
impl From<Error> for WeChatError
Source§impl From<Error> for WeChatError
impl From<Error> for WeChatError
Source§impl From<Error> for WeChatError
impl From<Error> for WeChatError
Auto Trait Implementations§
impl Freeze for WeChatError
impl RefUnwindSafe for WeChatError
impl Send for WeChatError
impl Sync for WeChatError
impl Unpin for WeChatError
impl UnwindSafe for WeChatError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.