pub enum TransportError {
InvalidPath {
path: String,
source: ParseError,
},
Unreachable {
request: RequestLabel,
source: Error,
},
CredentialRejected {
request: RequestLabel,
},
NotFound {
request: RequestLabel,
},
RateLimited {
request: RequestLabel,
wait: Option<Duration>,
},
RateLimitWaitTooLong {
request: RequestLabel,
wait: Duration,
},
Rejected {
request: RequestLabel,
status: u16,
body: String,
},
Unexpected {
request: RequestLabel,
status: u16,
body: String,
},
TooManyPages {
request: RequestLabel,
limit: usize,
},
Malformed {
request: RequestLabel,
source: Box<DeserializeError>,
},
}Expand description
Anything that stops a request from producing a usable answer.
Headers are never included in any variant, so a credential cannot reach a log or an error message through here.
Variants§
InvalidPath
The request path does not join cleanly onto the transport base.
Fields
source: ParseErrorThe failure Url::join reported.
Unreachable
The request never reached the forge, or no answer came back.
Fields
request: RequestLabelThe method and path that were attempted.
source: ErrorThe underlying transport failure.
CredentialRejected
The credential is missing or invalid (401).
Fields
request: RequestLabelThe method and path that were attempted.
NotFound
The addressed resource is not there (404).
Fields
request: RequestLabelThe method and path that were attempted.
RateLimited
The forge asked the caller to slow down (429, or a 403 that carries rate limit headers).
Fields
request: RequestLabelThe method and path that were attempted.
RateLimitWaitTooLong
The forge asked for a longer wait than this transport honours.
Fields
request: RequestLabelThe method and path that were attempted.
Rejected
The forge read the request and refused it (400, 403, or 422).
Fields
request: RequestLabelThe method and path that were attempted.
Unexpected
A status this transport does not otherwise classify, including a server error (5xx) that survived every retry.
Fields
request: RequestLabelThe method and path that were attempted.
TooManyPages
A listing still had more pages after the page limit.
Fields
request: RequestLabelThe method and path of the first page.
Malformed
The forge answered successfully, but the body does not decode.
Fields
request: RequestLabelThe method and path that were attempted.
Implementations§
Source§impl TransportError
impl TransportError
Sourcepub const fn request(&self) -> Option<&RequestLabel>
pub const fn request(&self) -> Option<&RequestLabel>
The request that failed, when the failure belongs to one.
Sourcepub const fn retry_after(&self) -> Option<Duration>
pub const fn retry_after(&self) -> Option<Duration>
The wait the forge asked for before a retry.
Sourcepub const fn is_uncertain(&self) -> bool
pub const fn is_uncertain(&self) -> bool
Whether the forge may or may not have applied the request.
That is a connection failure or a 5xx answer.
Sourcefn from_status(
request: RequestLabel,
status: u16,
body: String,
wait: Option<Duration>,
) -> Self
fn from_status( request: RequestLabel, status: u16, body: String, wait: Option<Duration>, ) -> Self
Map a status, body, and the wait its headers ask for to the failure class it represents.
Trait Implementations§
Source§impl Debug for TransportError
impl Debug for TransportError
Source§impl Display for TransportError
impl Display for TransportError
Source§impl Error for TransportError
impl Error for TransportError
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()