#[non_exhaustive]pub enum Error {
Show 31 variants
InvalidUri {
uri: String,
},
InvalidNoProxyRule {
rule: String,
},
InvalidProxyConfig {
proxy_uri: String,
message: String,
},
ProxyAuthorizationRequiresHttpProxy,
InvalidAdaptiveConcurrencyPolicy {
min_limit: usize,
initial_limit: usize,
max_limit: usize,
message: &'static str,
},
SerializeJson {
source: Error,
},
SerializeQuery {
source: Error,
},
SerializeForm {
source: Error,
},
RequestBuild {
source: Error,
},
Transport {
kind: TransportErrorKind,
method: Method,
uri: String,
message: String,
source: Box<dyn Error + Send + Sync>,
},
Timeout {
phase: TimeoutPhase,
timeout_ms: u128,
method: Method,
uri: String,
},
DeadlineExceeded {
timeout_ms: u128,
method: Method,
uri: String,
},
ReadBody {
source: Box<dyn Error + Send + Sync>,
},
WriteBody {
method: Method,
uri: String,
source: Box<dyn Error + Send + Sync>,
},
ResponseBodyTooLarge {
limit_bytes: usize,
actual_bytes: usize,
method: Method,
uri: String,
},
HttpStatus {
status: u16,
method: Method,
uri: String,
headers: Box<HeaderMap>,
body: String,
},
DeserializeJson {
source: Error,
body: String,
},
DecodeText {
source: Utf8Error,
body: String,
},
InvalidHeaderName {
name: String,
source: InvalidHeaderName,
},
InvalidHeaderValue {
name: String,
source: InvalidHeaderValue,
},
DecodeContentEncoding {
encoding: String,
method: Method,
uri: String,
message: String,
},
ConcurrencyLimitClosed,
TlsBackendUnavailable {
backend: &'static str,
},
TlsBackendInit {
backend: &'static str,
message: String,
},
TlsConfig {
backend: &'static str,
message: String,
},
RetryBudgetExhausted {
method: Method,
uri: String,
},
CircuitOpen {
method: Method,
uri: String,
retry_after_ms: u128,
},
MissingRedirectLocation {
status: u16,
method: Method,
uri: String,
},
InvalidRedirectLocation {
location: String,
method: Method,
uri: String,
},
RedirectLimitExceeded {
max_redirects: usize,
method: Method,
uri: String,
},
RedirectBodyNotReplayable {
method: Method,
uri: String,
},
}Expand description
Error returned by reqx.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidUri
The base URL or request URI was invalid.
InvalidNoProxyRule
A no_proxy rule could not be parsed.
InvalidProxyConfig
Proxy configuration was internally inconsistent.
ProxyAuthorizationRequiresHttpProxy
proxy_authorization(...) was used without configuring http_proxy(...).
InvalidAdaptiveConcurrencyPolicy
Adaptive concurrency settings were invalid.
Fields
SerializeJson
Serializing a JSON request body failed.
SerializeQuery
Serializing query parameters failed.
SerializeForm
Serializing a form request body failed.
RequestBuild
Building the HTTP request object failed.
Transport
The transport layer failed before a response was received.
Fields
kind: TransportErrorKindHigh-level transport failure category.
Timeout
A request phase exceeded its timeout.
Fields
phase: TimeoutPhaseTimeout phase that elapsed.
DeadlineExceeded
The overall request deadline elapsed.
Fields
ReadBody
Reading a buffered response body failed.
WriteBody
Writing a streamed response body to a sink failed.
Fields
ResponseBodyTooLarge
The response body exceeded the configured byte limit.
Fields
HttpStatus
The response status failed the active status policy.
Fields
DeserializeJson
Deserializing a JSON response body failed.
DecodeText
Decoding the response body as UTF-8 failed.
InvalidHeaderName
A header name was invalid.
Fields
source: InvalidHeaderNameSource header parsing error.
InvalidHeaderValue
A header value was invalid.
Fields
source: InvalidHeaderValueSource header parsing error.
DecodeContentEncoding
Decoding a compressed response body failed.
Fields
ConcurrencyLimitClosed
A request could not enter a closed concurrency limiter.
The selected TLS backend is not compiled into this build.
TlsBackendInit
Initializing the selected TLS backend failed.
Fields
TlsConfig
TLS configuration was not supported by the selected backend.
Fields
RetryBudgetExhausted
Retry budget enforcement rejected another retry attempt.
CircuitOpen
The circuit breaker rejected the request.
Fields
MissingRedirectLocation
A redirect response did not include a Location header.
Fields
InvalidRedirectLocation
A redirect target could not be parsed.
Fields
RedirectLimitExceeded
Redirect handling exceeded the configured redirect limit.
Fields
RedirectBodyNotReplayable
Redirect handling required replaying a non-replayable request body.
Implementations§
Source§impl Error
impl Error
Sourcepub const fn code(&self) -> ErrorCode
pub const fn code(&self) -> ErrorCode
Returns the stable machine-readable error code for this error.
Sourcepub const fn status_code(&self) -> Option<u16>
pub const fn status_code(&self) -> Option<u16>
Returns the HTTP status code for Error::HttpStatus.
Sourcepub const fn response_headers(&self) -> Option<&HeaderMap>
pub const fn response_headers(&self) -> Option<&HeaderMap>
Returns the captured response headers for Error::HttpStatus.
Sourcepub fn retry_after(&self, now: SystemTime) -> Option<Duration>
pub fn retry_after(&self, now: SystemTime) -> Option<Duration>
Parses a Retry-After hint from the captured response headers.
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Returns a request identifier from captured response headers when available.
Sourcepub fn request_method(&self) -> Option<&Method>
pub fn request_method(&self) -> Option<&Method>
Returns the originating request method when the error carries one.
Sourcepub fn request_uri_redacted(&self) -> Option<&str>
pub fn request_uri_redacted(&self) -> Option<&str>
Returns the redacted request URI associated with this error.
Sourcepub fn request_uri_redacted_owned(&self) -> Option<String>
pub fn request_uri_redacted_owned(&self) -> Option<String>
Returns an owned copy of the redacted request URI.
Sourcepub fn request_path(&self) -> Option<String>
pub fn request_path(&self) -> Option<String>
Returns just the request path component when a request URI is available.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()