Skip to main content

TransportError

Enum TransportError 

Source
#[non_exhaustive]
pub enum TransportError { Transport { class: TransportErrorClass, detail: Redacted<String>, }, Configuration { message: Redacted<String>, }, HttpStatus { status: u16, headers: Vec<(String, Redacted<String>)>, body: Redacted<String>, }, }
Expand description

Production HTTP transport seam and its typed surfaces.

HttpTransport is the async injection point downstream clients consume; TransportResponse is its success envelope (2xx status, redacted headers, body); TransportError is its typed failure surface, and TransportErrorClass is the label telemetry and retry layers use to partition REST-transport failures without parsing error messages. The native default implementation is ReqwestTransport; the browser default lives in cow-sdk-core (transport::fetch). Typed error surface returned by every HttpTransport implementation.

Transport adapters funnel every failure into this enum so downstream telemetry, retry, and backoff layers observe a uniform classification without parsing free-form error strings. The Transport variant pairs a TransportErrorClass tag with a redacted detail string; the Configuration variant captures builder-time or input-validation failures that happen before a network request is dispatched; the HttpStatus variant captures a non-2xx response so the orderbook and subgraph layers receive the numeric status, response headers, and body together without rebuilding them from free-form error strings.

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.
§

Transport

Network or request-execution failure observed by the transport layer.

Fields

§class: TransportErrorClass

Categorical failure mode taken from the documented is_timeout, is_connect, is_redirect, is_decode, is_body, is_builder, is_request, is_status, fallthrough partition.

§detail: Redacted<String>

Redacted detail message with any URL stripped by the adapter before the wrap.

§

Configuration

Builder-time or input-validation failure that prevented a request from being dispatched.

Fields

§message: Redacted<String>

Human-readable configuration-validation message.

§

HttpStatus

Non-2xx HTTP response returned by the remote endpoint.

Adapters surface the numeric status code and the raw response body together with the response headers through this variant so downstream orchestration can classify the outcome without re-reading the transport’s rendered error text.

Fields

§status: u16

Numeric HTTP status code returned by the remote endpoint.

§headers: Vec<(String, Redacted<String>)>

Response headers returned alongside the non-success status code.

§body: Redacted<String>

Raw response body returned alongside the status code.

Implementations§

Source§

impl TransportError

Source

pub const fn class(&self) -> Option<TransportErrorClass>

Returns the TransportErrorClass for Transport variants and None for configuration and HTTP-status failures.

Trait Implementations§

Source§

impl Debug for TransportError

Source§

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

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

impl Display for TransportError

Source§

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

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

impl Error for TransportError

1.30.0 · 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

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<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> Same for T

Source§

type Output = T

Should always be Self
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> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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