pub enum HttpError {
Response(HttpResponseError),
MaxRetries(MaxHttpRetriesExceededError),
InvalidRequest(InvalidHttpRequestError),
Network(Error),
}Expand description
Unified error type for all HTTP-related errors.
This enum provides a single error type for HTTP operations, making it easier to handle errors at API boundaries. Use pattern matching to handle specific error types.
§Example
ⓘ
use shopify_sdk::HttpError;
let result = client.request(request).await;
match result {
Ok(response) => { /* handle success */ }
Err(HttpError::Response(e)) => { /* handle API error */ }
Err(HttpError::MaxRetries(e)) => { /* handle retry exhaustion */ }
Err(HttpError::InvalidRequest(e)) => { /* handle validation error */ }
Err(HttpError::Network(e)) => { /* handle network error */ }
}Variants§
Response(HttpResponseError)
An HTTP response error (non-2xx status code).
MaxRetries(MaxHttpRetriesExceededError)
Maximum retry attempts exhausted.
InvalidRequest(InvalidHttpRequestError)
Request validation failed.
Network(Error)
Network or connection error.
Trait Implementations§
Source§impl Error for HttpError
impl Error for HttpError
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<HttpError> for GraphqlError
impl From<HttpError> for GraphqlError
Source§impl From<HttpError> for OAuthError
impl From<HttpError> for OAuthError
Source§impl From<HttpError> for ResourceError
impl From<HttpError> for ResourceError
Source§impl From<HttpResponseError> for HttpError
impl From<HttpResponseError> for HttpError
Source§fn from(source: HttpResponseError) -> Self
fn from(source: HttpResponseError) -> Self
Converts to this type from the input type.
Source§impl From<InvalidHttpRequestError> for HttpError
impl From<InvalidHttpRequestError> for HttpError
Source§fn from(source: InvalidHttpRequestError) -> Self
fn from(source: InvalidHttpRequestError) -> Self
Converts to this type from the input type.
Source§impl From<MaxHttpRetriesExceededError> for HttpError
impl From<MaxHttpRetriesExceededError> for HttpError
Source§fn from(source: MaxHttpRetriesExceededError) -> Self
fn from(source: MaxHttpRetriesExceededError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for HttpError
impl !RefUnwindSafe for HttpError
impl Send for HttpError
impl Sync for HttpError
impl Unpin for HttpError
impl !UnwindSafe for HttpError
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