pub enum ZaiError {
HttpError {
status: u16,
message: String,
},
AuthError {
code: u16,
message: String,
},
AccountError {
code: u16,
message: String,
},
ApiError {
code: u16,
message: String,
},
RateLimitError {
code: u16,
message: String,
},
ContentPolicyError {
code: u16,
message: String,
},
FileError {
code: u16,
message: String,
},
NetworkError(Arc<Error>),
JsonError(Arc<Error>),
Unknown {
code: u16,
message: String,
},
}Expand description
Main error type for the ZAI-RS SDK
Variants§
HttpError
HTTP status errors
AuthError
Authentication and authorization errors
AccountError
Account-related errors
ApiError
API call errors
RateLimitError
Rate limiting and quota errors
ContentPolicyError
Content policy errors
FileError
File processing errors
NetworkError(Arc<Error>)
Network/IO errors (wrapped in Arc for Clone support)
JsonError(Arc<Error>)
JSON parsing errors (wrapped in Arc for Clone support)
Unknown
Other errors
Implementations§
Source§impl ZaiError
impl ZaiError
Sourcepub fn from_api_response(
status: u16,
api_code: u16,
api_message: String,
) -> Self
pub fn from_api_response( status: u16, api_code: u16, api_message: String, ) -> Self
Convert an HTTP status code and API error response to a ZaiError
Sourcepub fn is_rate_limit(&self) -> bool
pub fn is_rate_limit(&self) -> bool
Check if the error is a rate limit error
Sourcepub fn is_auth_error(&self) -> bool
pub fn is_auth_error(&self) -> bool
Check if the error is an authentication error
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 ZaiError
impl Error for ZaiError
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<ValidationErrors> for ZaiError
Convert from validator::ValidationErrors to ZaiError
impl From<ValidationErrors> for ZaiError
Convert from validator::ValidationErrors to ZaiError
Source§fn from(err: ValidationErrors) -> Self
fn from(err: ValidationErrors) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ZaiError
impl !RefUnwindSafe for ZaiError
impl Send for ZaiError
impl Sync for ZaiError
impl Unpin for ZaiError
impl UnsafeUnpin for ZaiError
impl !UnwindSafe for ZaiError
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> 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.
Source§impl<T> ValidateIp for Twhere
T: ToString,
impl<T> ValidateIp for Twhere
T: ToString,
Source§fn validate_ipv4(&self) -> bool
fn validate_ipv4(&self) -> bool
Validates whether the given string is an IP V4
Source§fn validate_ipv6(&self) -> bool
fn validate_ipv6(&self) -> bool
Validates whether the given string is an IP V6
Source§fn validate_ip(&self) -> bool
fn validate_ip(&self) -> bool
Validates whether the given string is an IP