pub enum ApifyClientError {
Api(Box<ApiError>),
Http(String),
Timeout,
Serde(Error),
InvalidResponse(String),
InvalidArgument(String),
}Expand description
The top-level error type for all client operations: every method returns
Result<T, ApifyClientError>, so one match/if let already catches every kind of failure.
Variants§
Api(Box<ApiError>)
The API returned a non-success status code with a structured error body.
Boxed to keep the overall Result size small (the error path is rare).
Http(String)
A network/transport-level error occurred (connection failure, timeout, etc.).
Timeout
The request timed out.
Serde(Error)
Failed to serialize the request body or deserialize the response body.
InvalidResponse(String)
The response body could not be interpreted as expected.
InvalidArgument(String)
A required configuration value or argument was missing or invalid.
Implementations§
Source§impl ApifyClientError
impl ApifyClientError
Sourcepub fn as_api_error(&self) -> Option<&ApiError>
pub fn as_api_error(&self) -> Option<&ApiError>
Returns the underlying ApiError if this is an API error, otherwise None.
Sourcepub fn status_code(&self) -> Option<u16>
pub fn status_code(&self) -> Option<u16>
Returns the HTTP status code if this error originated from an API response.
Trait Implementations§
Source§impl Debug for ApifyClientError
impl Debug for ApifyClientError
Source§impl Display for ApifyClientError
impl Display for ApifyClientError
Source§impl Error for ApifyClientError
impl Error for ApifyClientError
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
use the Display impl or to_string()