pub enum RetrofitError {
Show 13 variants
ConnectionError {
url: String,
message: String,
},
TimeoutError {
method: String,
url: String,
duration: Duration,
},
DnsError {
host: String,
message: String,
},
TlsError {
url: String,
message: String,
},
HttpError {
status: u16,
reason: String,
method: String,
url: String,
headers: Box<HashMap<String, String>>,
body: Option<Box<String>>,
},
JsonError {
context: String,
message: String,
},
InvalidResponseFormat {
expected: String,
actual: String,
},
UrlParseError {
url: String,
message: String,
},
ConfigError(String),
RequestBuildError {
method: String,
path: String,
message: String,
},
TooManyRedirects {
url: String,
count: usize,
},
BodyReadError {
url: String,
message: String,
},
RequestError(String),
}
Expand description
Retrofit error types with detailed context
Variants§
ConnectionError
Connection failed (network unreachable, connection refused, etc.)
TimeoutError
Request timeout
DnsError
DNS resolution failed
TlsError
TLS/SSL error
HttpError
HTTP status error with detailed context
Fields
JsonError
JSON serialization/deserialization failed
InvalidResponseFormat
Invalid response format
UrlParseError
URL parsing/building failed
ConfigError(String)
Configuration error
RequestBuildError
Request building error
TooManyRedirects
Too many redirects
BodyReadError
Body reading error
RequestError(String)
Generic request error (catch-all for reqwest errors)
Implementations§
Source§impl RetrofitError
impl RetrofitError
Sourcepub fn connection_error(
url: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn connection_error( url: impl Into<String>, message: impl Into<String>, ) -> Self
Create a connection error
Sourcepub fn timeout_error(
method: impl Into<String>,
url: impl Into<String>,
duration: Duration,
) -> Self
pub fn timeout_error( method: impl Into<String>, url: impl Into<String>, duration: Duration, ) -> Self
Create a timeout error
Sourcepub fn http_error(
status: u16,
method: impl Into<String>,
url: impl Into<String>,
body: Option<String>,
) -> Self
pub fn http_error( status: u16, method: impl Into<String>, url: impl Into<String>, body: Option<String>, ) -> Self
Create an HTTP error
Sourcepub fn http_error_with_headers(
status: u16,
method: impl Into<String>,
url: impl Into<String>,
headers: HashMap<String, String>,
body: Option<String>,
) -> Self
pub fn http_error_with_headers( status: u16, method: impl Into<String>, url: impl Into<String>, headers: HashMap<String, String>, body: Option<String>, ) -> Self
Create an HTTP error with headers
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Check if this is a timeout error
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Check if this is a client error (4xx)
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Check if this is a server error (5xx)
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if error is retryable
Trait Implementations§
Source§impl Debug for RetrofitError
impl Debug for RetrofitError
Source§impl Display for RetrofitError
impl Display for RetrofitError
Source§impl Error for RetrofitError
impl Error for RetrofitError
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<Error> for RetrofitError
Convert from reqwest::Error with context
impl From<Error> for RetrofitError
Convert from reqwest::Error with context
Auto Trait Implementations§
impl Freeze for RetrofitError
impl RefUnwindSafe for RetrofitError
impl Send for RetrofitError
impl Sync for RetrofitError
impl Unpin for RetrofitError
impl UnwindSafe for RetrofitError
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