Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 18 variants Io(Error), Tls(Error), Record(&'static str), Ws(&'static str), Http(String), Upgrade { status: u16, body: String, retry_after_ms: Option<u64>, retry_after_invalid: bool, }, Unanswered(Box<Unanswered>), CurlResend { method: String, }, Closed, WsClose(Box<Close>), Config(String), Unsupported(&'static str), Dns(String), Timeout(&'static str), Busy(&'static str), QuickAck(Box<QuickAckError>), Cpu(Box<CpuError>), HostCheck(Box<HostCheckError>),
}
Expand description

An I/O, protocol or configuration error.

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

Io(Error)

Operating-system I/O failure.

§

Tls(Error)

TLS failure reported by rustls.

§

Record(&'static str)

Record-layer failure (bad record, AEAD failure, unexpected content).

§

Ws(&'static str)

WebSocket protocol violation.

§

Http(String)

HTTP failure (a malformed response or upgrade).

§

Upgrade

The server answered the WebSocket upgrade with status, not 101.

Fields

§status: u16

HTTP status code.

§body: String

The start of the response body (at most 300 bytes).

§retry_after_ms: Option<u64>

The server’s Retry-After, in ms (see crate::outcome::retry_after_ms); None without one. Wait at least this long before connecting again (a 429 or 418 refusal).

§retry_after_invalid: bool

The response had a Retry-After that is neither seconds nor an HTTP date (retry_after_ms is then None).

§

Unanswered(Box<Unanswered>)

An HTTP connection closed with requests unanswered. HttpConn users get it in Handler::on_closed; HttpClient reports each request’s crate::outcome::Sent to ClientHandler::on_error instead. Boxed: rare.

§

CurlResend

The libcurl HttpClient refused method: libcurl sends a request again, up to 5 times, when the reused connection it went out on dies before any reply byte, so an order could run twice. Without HttpClientConfig::curl_allow_non_idempotent_methods it takes only GET, HEAD, OPTIONS and DELETE. The native client never re-sends.

Fields

§method: String

The refused method.

§

Closed

The peer closed the connection without a WebSocket close handshake.

§

WsClose(Box<Close>)

A WebSocket close handshake ended the connection: the code and reason, and who started it. Boxed: rare, and it keeps Result small.

§

Config(String)

Bad configuration input.

§

Unsupported(&'static str)

The backend is not available on this platform or build.

§

Dns(String)

Name resolution failed.

§

Timeout(&'static str)

An operation did not finish in time.

§

Busy(&'static str)

A limit was reached; retry later.

§

QuickAck(Box<QuickAckError>)

The quick-ACK route check refused the connection (crate::route::QuickAckCheck::Require). Boxed: it is rare, and every Result of this crate carries the size of the largest variant.

§

Cpu(Box<CpuError>)

A helper thread has no CPU it may use (crate::placement): the process may use the polling CPU only (a pod with one CPU), or a CPU setting names one outside its cpuset. Boxed: rare.

§

HostCheck(Box<HostCheckError>)

The host-check switch (ERGON_HOST_CHECKS): it is set to something other than off, on or require, or it is require and a host check warned (crate::checks::HostReport::refusal). Boxed: rare.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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<CpuError> for Error

Source§

fn from(e: CpuError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<HostCheckError> for Error

Source§

fn from(e: HostCheckError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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