pub enum ProtocolError {
IncompleteHeader {
message: Option<String>,
},
TruncatedPayload {
message: Option<String>,
},
UnknownFrameType {
type_id: u8,
message: Option<String>,
},
InvalidStream {
frame_type: FrameType,
stream_id: u32,
message: Option<String>,
},
InvalidStateTransition {
current_state: ConnectionState,
frame_type: FrameType,
message: Option<String>,
},
AuthenticationFailure {
message: Option<String>,
},
VersionMismatch {
message: Option<String>,
},
SchemaIncompatible {
message: Option<String>,
},
CodecError {
message: Option<String>,
},
}Expand description
Protocol-level failures with stable numeric reason codes for error frames and metrics.
Variants§
IncompleteHeader
A frame header did not contain all fixed-size header bytes.
TruncatedPayload
A frame header declared more payload bytes than were present.
UnknownFrameType
An unknown frame type was observed for logging or metrics.
InvalidStream
A frame appeared on a stream that is invalid for its type.
InvalidStateTransition
A frame would move the protocol connection through an invalid state transition.
AuthenticationFailure
Authentication failed during connection setup.
VersionMismatch
The peers could not agree on a compatible protocol version.
SchemaIncompatible
A requested schema is incompatible with this connection or stream.
CodecError
Bytes could not be encoded or decoded according to the frame format.
Implementations§
Source§impl ProtocolError
impl ProtocolError
Sourcepub const INCOMPLETE_HEADER_CODE: u16 = 0x0001
pub const INCOMPLETE_HEADER_CODE: u16 = 0x0001
Malformed header reason code.
Sourcepub const TRUNCATED_PAYLOAD_CODE: u16 = 0x0002
pub const TRUNCATED_PAYLOAD_CODE: u16 = 0x0002
Truncated payload reason code.
Sourcepub const UNKNOWN_FRAME_TYPE_CODE: u16 = 0x0003
pub const UNKNOWN_FRAME_TYPE_CODE: u16 = 0x0003
Unknown frame type reason code.
Sourcepub const INVALID_STREAM_CODE: u16 = 0x0004
pub const INVALID_STREAM_CODE: u16 = 0x0004
Invalid stream reason code.
Sourcepub const INVALID_STATE_TRANSITION_CODE: u16 = 0x0005
pub const INVALID_STATE_TRANSITION_CODE: u16 = 0x0005
Invalid state transition reason code.
Sourcepub const AUTHENTICATION_FAILURE_CODE: u16 = 0x0006
pub const AUTHENTICATION_FAILURE_CODE: u16 = 0x0006
Authentication failure reason code.
Sourcepub const VERSION_MISMATCH_CODE: u16 = 0x0007
pub const VERSION_MISMATCH_CODE: u16 = 0x0007
Version mismatch reason code.
Sourcepub const SCHEMA_INCOMPATIBLE_CODE: u16 = 0x0008
pub const SCHEMA_INCOMPATIBLE_CODE: u16 = 0x0008
Schema incompatibility reason code.
Sourcepub const CODEC_ERROR_CODE: u16 = 0x0009
pub const CODEC_ERROR_CODE: u16 = 0x0009
Codec error reason code.
Sourcepub const fn reason_code(&self) -> u16
pub const fn reason_code(&self) -> u16
Return the stable numeric reason code for this error.
Trait Implementations§
Source§impl Clone for ProtocolError
impl Clone for ProtocolError
Source§fn clone(&self) -> ProtocolError
fn clone(&self) -> ProtocolError
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 ProtocolError
impl Debug for ProtocolError
Source§impl Display for ProtocolError
impl Display for ProtocolError
impl Eq for ProtocolError
Source§impl Error for ProtocolError
impl Error for ProtocolError
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()
Source§impl PartialEq for ProtocolError
impl PartialEq for ProtocolError
Source§fn eq(&self, other: &ProtocolError) -> bool
fn eq(&self, other: &ProtocolError) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ProtocolError
Auto Trait Implementations§
impl Freeze for ProtocolError
impl RefUnwindSafe for ProtocolError
impl Send for ProtocolError
impl Sync for ProtocolError
impl Unpin for ProtocolError
impl UnsafeUnpin for ProtocolError
impl UnwindSafe for ProtocolError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.