#[non_exhaustive]pub enum Error {
Io(Error),
Timeout(TimeoutError),
Protocol(ProtocolError),
Config(ConfigError),
Http(Error),
External(BoxError),
}Expand description
Top-level error type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io(Error)
Transport-level I/O error (TCP read/write/connect).
Timeout(TimeoutError)
Operation exceeded a configured deadline.
Protocol(ProtocolError)
Wire-protocol failure (parsing, headers, encapsulation, etc.).
Config(ConfigError)
Builder / configuration failure (invalid service options, unknown alias, missing handlers, …).
Http(Error)
Error returned by the http crate builders.
External(BoxError)
Error from outside this crate, preserved via ToIcapResult or
Error::external. The original error is available through source().
Implementations§
Source§impl Error
impl Error
Sourcepub const fn is_io(&self) -> bool
pub const fn is_io(&self) -> bool
True if the error originates from an I/O failure on the transport.
Sourcepub const fn is_timeout(&self) -> bool
pub const fn is_timeout(&self) -> bool
True if the error originates from a deadline (any TimeoutKind).
Sourcepub const fn is_protocol(&self) -> bool
pub const fn is_protocol(&self) -> bool
True if the error came from the wire protocol layer.
Sourcepub const fn is_body_too_large(&self) -> bool
pub const fn is_body_too_large(&self) -> bool
True if the peer sent an embedded body larger than a configured limit.
Sourcepub const fn is_config(&self) -> bool
pub const fn is_config(&self) -> bool
True if the error came from builder / configuration validation.
Sourcepub const fn is_early_close(&self) -> bool
pub const fn is_early_close(&self) -> bool
True for the “peer closed before headers” case — common on kept-alive connections that the server has idle-closed.
Sourcepub const fn is_retryable(&self) -> bool
pub const fn is_retryable(&self) -> bool
True if a fresh attempt is likely to succeed.
Conservative: connection-establishment timeouts, idle keep-alive
closure, and EarlyClose are considered retryable. Application-level
protocol errors are not retryable — the peer will reject the same
bytes again.
Sourcepub fn http_parse(message: impl Into<String>) -> Self
pub fn http_parse(message: impl Into<String>) -> Self
Build an embedded-HTTP parse error.
Sourcepub const fn body_too_large(size: usize, max: usize) -> Self
pub const fn body_too_large(size: usize, max: usize) -> Self
Build an oversized-body protocol error.
Sourcepub fn serialization(message: impl Into<String>) -> Self
pub fn serialization(message: impl Into<String>) -> Self
Build a serialization error.
Sourcepub const fn missing_header(name: &'static str) -> Self
pub const fn missing_header(name: &'static str) -> Self
Build a “missing required header” protocol error.
Sourcepub fn invalid_istag(value: impl Into<String>) -> Self
pub fn invalid_istag(value: impl Into<String>) -> Self
Build an “invalid ISTag” protocol error.
Sourcepub fn invalid_status_code(value: impl Into<String>) -> Self
pub fn invalid_status_code(value: impl Into<String>) -> Self
Build an “invalid status code” protocol error.
Sourcepub fn invalid_method(value: impl Into<String>) -> Self
pub fn invalid_method(value: impl Into<String>) -> Self
Build an “invalid method” protocol error.
Sourcepub fn invalid_uri(value: impl Into<String>) -> Self
pub fn invalid_uri(value: impl Into<String>) -> Self
Build an “invalid URI” protocol error.
Sourcepub fn invalid_version(value: impl Into<String>) -> Self
pub fn invalid_version(value: impl Into<String>) -> Self
Build an “invalid protocol version” protocol error.
Sourcepub fn unexpected(message: impl Into<String>) -> Self
pub fn unexpected(message: impl Into<String>) -> Self
Build an External error from an ad-hoc message string.
Sourcepub const fn timeout(kind: TimeoutKind, duration: Duration) -> Self
pub const fn timeout(kind: TimeoutKind, duration: Duration) -> Self
Build a Timeout from a kind + duration.
pub const fn client_total_timeout(d: Duration) -> Self
pub const fn client_connect_timeout(d: Duration) -> Self
pub const fn client_write_timeout(d: Duration) -> Self
pub const fn client_continue_timeout(d: Duration) -> Self
pub const fn server_header_read_timeout(d: Duration) -> Self
pub const fn server_body_read_timeout(d: Duration) -> Self
pub const fn server_write_timeout(d: Duration) -> Self
pub const fn server_idle_timeout(d: Duration) -> Self
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()