pub enum ClientError {
Auth {
message: String,
},
Server {
message: String,
code: Option<String>,
},
Connection {
message: String,
},
Timeout,
FrameTooLarge {
message: String,
},
Decode {
message: String,
},
}Expand description
The stable error classes of the client contract (CLT-050).
Variants are the public API — matching on them is supported forever.
Clone is required so one connection failure can fan out to every
pending call (CLT-014).
Variants§
Auth
Authentication / authorization failure — handshake rejections
(CLT-003) and NOAUTH/WRONGPASS/NOPERM-prefixed replies
(CLT-051).
Server
The server answered the call with Result::Err.
Fields
Connection
Transport-level failure: dial, write, or the connection dying while the call was pending (CLT-004/030/031). Also raised for invalid endpoints (CLT-070).
Timeout
The per-call (or connect) timeout elapsed (CLT-020). The pending entry was removed; a late response is dropped per CLT-013.
FrameTooLarge
The server sent a frame larger than the profile cap; the connection was poisoned (WIRE-020 via CLT-014).
Decode
The server sent a malformed frame (or a push frame under a
Reserved profile, CLT-060); the connection was poisoned
(CLT-014).
Implementations§
Source§impl ClientError
impl ClientError
Sourcepub fn from_server_message(
message: impl Into<String>,
convention: ErrorConvention,
) -> Self
pub fn from_server_message( message: impl Into<String>, convention: ErrorConvention, ) -> Self
Parse a server error string per the profile’s convention (CLT-050, PRO-014).
Resp3Prefixes:NOAUTH/WRONGPASS/NOPERM→Self::Auth; everything else (ERR …included) →Self::Server.BracketCode: a leading"[code] "is extracted intocode; the auth prefixes still map toSelf::Authregardless of convention (CLT-051).Both: composes the two — bracket code first, then prefixes.None: no parsing; the raw message becomesSelf::Server.
message always carries the raw string, verbatim.
Trait Implementations§
Source§impl Clone for ClientError
impl Clone for ClientError
Source§fn clone(&self) -> ClientError
fn clone(&self) -> ClientError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClientError
impl Debug for ClientError
Source§impl Display for ClientError
impl Display for ClientError
impl Eq for ClientError
Source§impl Error for ClientError
impl Error for ClientError
1.30.0 · 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()