#[non_exhaustive]pub enum ClientError {
Show 15 variants
Config(String),
Http(Error),
ResponseTooLarge {
limit: usize,
},
TrustTaskError {
http_status: u16,
error: Box<ErrorResponse>,
},
HttpStatus {
http_status: u16,
body: String,
},
ResponseDecode(String),
DuplicateAbsorbed {
http_status: u16,
},
ResponseThreadMismatch {
expected: String,
actual: Option<String>,
},
ResponseTypeMismatch {
expected: String,
actual: String,
},
ResponseIssuerMismatch {
expected: String,
actual: Option<String>,
},
ResponseRecipientMismatch {
expected: String,
actual: Option<String>,
},
ErrorResponseMismatch {
expected: String,
actual: String,
},
ResponseProofMissing,
ResponseProofInvalid(String),
UnverifiedErrorResponse {
http_status: u16,
reason: String,
error: Box<ErrorResponse>,
},
}client only.Expand description
Errors raised by HttpsClient::send.
#[non_exhaustive]: match with a wildcard arm, so a variant added later
is not a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Config(String)
The client was constructed with missing or invalid configuration.
Http(Error)
The HTTP request itself failed (DNS, connect, TLS, etc.).
ResponseTooLarge
The response body was larger than
HttpsClientBuilder::max_response_bytes. Reading stopped there and
nothing was decoded.
TrustTaskError
The server returned a trust-task-error response document.
http_status is the response’s HTTP status code.
Fields
error: Box<ErrorResponse>The parsed error-response document.
HttpStatus
Non-2xx HTTP response that did not parse as a trust-task-error
document (e.g. the server replied with plain text or an empty body,
or a redirect the client did not follow).
Fields
ResponseDecode(String)
2xx response whose body did not decode as the expected
TrustTask<Req::Response>.
DuplicateAbsorbed
A 2xx response with an empty body: the consumer had already accepted
this document under SPEC §7.2 item 11 and has no result to hand back —
202 Accepted while the original execution is still in progress,
204 No Content where the Trust Task specification defines no
success response.
This is not a failure. The effect happened; it did not happen
twice, which is the guarantee item 11 exists to give. §7.2 is explicit
that “in no case is a duplicate reported as taskFailed; the task did
not fail, it already happened” — a caller that folds every Err into
“the request failed” will misreport it. It arrives as an Err only
because HttpsClient::send is typed to return a response document
and there is none.
ResponseThreadMismatch
The response’s threadId does not correlate with the request
(SPEC §4.9). The response answers some other exchange.
Fields
ResponseTypeMismatch
The response’s type is not the #response variant of the
request’s type (SPEC §4.4.1).
Fields
ResponseIssuerMismatch
The response’s issuer is not the configured server_vid — the
answer did not come from the party this client addressed.
Fields
ResponseRecipientMismatch
The response’s recipient is not the configured my_vid — the
answer is addressed to somebody else.
Fields
ErrorResponseMismatch
An error response named a different document in inResponseTo.id
(SPEC §8.2) than the one this client sent.
Fields
ResponseProofMissing
A response verifier is configured but the response carried no
proof. See HttpsClientBuilder::with_response_verifier.
ResponseProofInvalid(String)
The response’s proof failed verification.
UnverifiedErrorResponse
A non-2xx response carried a trust-task-error document that this
client, configured with a response verifier, could not attest: it had
no proof, its proof did not verify, or its issuer / recipient did
not match. See HttpsClientBuilder::with_response_verifier.
Untrusted. error is what arrived, kept for diagnostics; anything
on the path could have written it. Do not act on its code as the
server’s verdict — treat the request’s outcome as unknown.
Trait Implementations§
Source§impl Debug for ClientError
impl Debug for ClientError
Source§impl Display for ClientError
impl Display for ClientError
Source§impl Error for ClientError
impl Error for ClientError
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()