pub enum ZealError {
Show 15 variants
NetworkError {
source: Error,
retryable: bool,
},
WebSocketError {
message: String,
},
JsonError {
source: Error,
},
ConfigurationError {
message: String,
},
ApiError {
status: u16,
message: String,
error_code: Option<String>,
},
NotFound {
resource: String,
id: String,
},
ValidationError {
field: String,
message: String,
},
AuthenticationError {
message: String,
},
RateLimitError {
message: String,
retry_after: Option<Duration>,
},
TimeoutError {
operation: String,
},
ConnectionError {
message: String,
},
SerializationError {
source: Box<dyn Error + Send + Sync>,
},
InvalidUrl {
source: ParseError,
},
IoError {
source: Error,
},
Other {
message: String,
},
}Expand description
Main error type for the Zeal SDK
Variants§
NetworkError
Network-related errors
WebSocketError
WebSocket-related errors
JsonError
JSON parsing errors
ConfigurationError
Invalid configuration
ApiError
API errors from the server
NotFound
Resource not found
ValidationError
Validation errors
AuthenticationError
Authentication/authorization errors
RateLimitError
Rate limiting errors
TimeoutError
Timeout errors
ConnectionError
Connection errors
SerializationError
Serialization errors
InvalidUrl
URL parsing errors
Fields
§
source: ParseErrorIoError
I/O errors
Other
Generic errors
Implementations§
Source§impl ZealError
impl ZealError
Sourcepub fn network_error(source: Error) -> Self
pub fn network_error(source: Error) -> Self
Create a network error
Sourcepub fn websocket_error<S: Into<String>>(message: S) -> Self
pub fn websocket_error<S: Into<String>>(message: S) -> Self
Create a WebSocket error
Sourcepub fn configuration_error<S: Into<String>>(message: S) -> Self
pub fn configuration_error<S: Into<String>>(message: S) -> Self
Create a configuration error
Sourcepub fn api_error(
status: u16,
message: String,
error_code: Option<String>,
) -> Self
pub fn api_error( status: u16, message: String, error_code: Option<String>, ) -> Self
Create an API error
Sourcepub fn validation_error<S: Into<String>>(field: S, message: S) -> Self
pub fn validation_error<S: Into<String>>(field: S, message: S) -> Self
Create a validation error
Sourcepub fn authentication_error<S: Into<String>>(message: S) -> Self
pub fn authentication_error<S: Into<String>>(message: S) -> Self
Create an authentication error
Sourcepub fn rate_limit_error<S: Into<String>>(
message: S,
retry_after: Option<Duration>,
) -> Self
pub fn rate_limit_error<S: Into<String>>( message: S, retry_after: Option<Duration>, ) -> Self
Create a rate limit error
Sourcepub fn timeout_error<S: Into<String>>(operation: S) -> Self
pub fn timeout_error<S: Into<String>>(operation: S) -> Self
Create a timeout error
Sourcepub fn connection_error<S: Into<String>>(message: S) -> Self
pub fn connection_error<S: Into<String>>(message: S) -> Self
Create a connection error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if the error is retryable
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
Get the retry delay if applicable
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Check if the error is a client error (4xx)
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Check if the error is a server error (5xx)
Trait Implementations§
Source§impl Error for ZealError
impl Error for ZealError
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<ParseError> for ZealError
impl From<ParseError> for ZealError
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ZealError
impl !RefUnwindSafe for ZealError
impl Send for ZealError
impl Sync for ZealError
impl Unpin for ZealError
impl !UnwindSafe for ZealError
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