Skip to main content

ClientError

Enum ClientError 

Source
#[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>, },
}
Available on crate feature 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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§limit: usize

The cap that was exceeded, in bytes.

§

TrustTaskError

The server returned a trust-task-error response document. http_status is the response’s HTTP status code.

Fields

§http_status: u16

The HTTP status code accompanying the error response.

§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

§http_status: u16

The HTTP status code.

§body: String

The start of the response body (at most 512 bytes), lossy-decoded as UTF-8, for diagnostics. Not part of the Display text: it is whatever the peer chose to send.

§

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.

Fields

§http_status: u16

The 2xx status carried: 202 (original still in flight) or 204.

§

ResponseThreadMismatch

The response’s threadId does not correlate with the request (SPEC §4.9). The response answers some other exchange.

Fields

§expected: String

The request’s threadId, or its id where the request opened the thread.

§actual: Option<String>

What the response carried, if anything.

§

ResponseTypeMismatch

The response’s type is not the #response variant of the request’s type (SPEC §4.4.1).

Fields

§expected: String

The request’s Type URI with the #response fragment.

§actual: String

What the response carried.

§

ResponseIssuerMismatch

The response’s issuer is not the configured server_vid — the answer did not come from the party this client addressed.

Fields

§expected: String

The configured server_vid.

§actual: Option<String>

What the response carried, if anything.

§

ResponseRecipientMismatch

The response’s recipient is not the configured my_vid — the answer is addressed to somebody else.

Fields

§expected: String

The configured my_vid.

§actual: Option<String>

What the response carried, if anything.

§

ErrorResponseMismatch

An error response named a different document in inResponseTo.id (SPEC §8.2) than the one this client sent.

Fields

§expected: String

The request’s id.

§actual: String

The inResponseTo.id the error response carried.

§

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.

Fields

§http_status: u16

The HTTP status code that accompanied it.

§reason: String

Why it could not be attested.

§error: Box<ErrorResponse>

The document as received. Unverified.

Trait Implementations§

Source§

impl Debug for ClientError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ClientError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ClientError

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for ClientError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more