#[non_exhaustive]pub enum Error {
Show 13 variants
Config(String),
Transport(Error),
Unauthorized {
message: String,
},
PayloadTooLarge {
message: String,
},
Overloaded {
message: String,
retry_after: Option<Duration>,
},
BlobsStillMissing {
missing: Vec<MissingBlob>,
},
#[non_exhaustive] Server {
status: u16,
code: ErrorCode,
message: String,
detail: Vec<String>,
},
UnexpectedStatus {
status: u16,
body: String,
},
InvalidResponse {
status: u16,
reason: String,
},
MissingAsset {
key: String,
},
BlobFetchFailed {
key: String,
source: BlobFetchError,
},
UnknownDigest {
digest: Digest,
},
DigestMismatch {
key: String,
declared: Digest,
actual: Digest,
},
}Expand description
Non-exhaustive, like Error::Server’s fields: new failure modes and
new server-supplied fields are not breaking changes, so a match needs a
wildcard arm and a Server { .. } pattern a ...
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Config(String)
The client was built with a base URL or token it cannot use.
Transport(Error)
The request never completed: DNS, connect, TLS, timeout, or a body that could not be read to the end.
401 — the bearer token is missing or wrong. The remedy is credentials,
not payload, which is why it is not folded into Error::Server.
Fields
PayloadTooLarge
413 — the body exceeded the server’s MDCAST_MAX_UPLOAD_BYTES.
Retrying the identical request is hopeless; the caller has to shrink or
split it.
Overloaded
503 with code overloaded — every render slot stayed busy for the
server’s whole queue wait. The request itself is fine: send it again
after retry_after (the server’s Retry-After, when it sent one).
BlobsStillMissing
A second 409 for the same render after the missing blobs were
uploaded. The client retries exactly once — the same digests coming
back means eviction is racing the retry or the server is misbehaving,
and looping would only hide it.
Fields
missing: Vec<MissingBlob>#[non_exhaustive]Server
The server answered with its own ErrorResponse — the code, the
message and any detail (sanitised engine diagnostics, sent only by a
server with MDCAST_EXPOSE_DIAGNOSTICS on) are carried through
verbatim.
Fields
This variant is marked as non-exhaustive
UnexpectedStatus
A status this protocol does not define, or one whose body is not an
ErrorResponse (a proxy or load balancer answering instead of mdcast).
InvalidResponse
The status was one the protocol defines, but its body did not decode.
MissingAsset
A manifest entry the bundle holds no bytes for. Caught locally: a 409
naming it would only tell the caller a digest it cannot resolve.
BlobFetchFailed
A digest-only bundle entry’s fetch closure failed to produce bytes at
all, while satisfying an upload the server actually asked for. Never a
silent skip — the retry would just 409 on the same digest again.
UnknownDigest
A digest asked for by hand (via crate::Client::upload) that nothing
in the bundle hashes to.
DigestMismatch
A caller-supplied manifest that disagrees with the bundle’s actual
bytes. The upload would be rejected server-side anyway — the server
re-hashes every byte — so it fails before the round trip. Also raised
when a digest-only entry’s fetch succeeds but the bytes it returns
hash to something other than the digest it was declared with.
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()