#[non_exhaustive]pub enum ProtocolError {
Show 13 variants
IncompletePacket {
expected: usize,
actual: usize,
},
InvalidPacketType(u8),
InvalidTokenType(u8),
InvalidDataType(u8),
InvalidPreloginOption(u8),
InvalidTdsVersion(u32),
StringEncoding(String),
PacketTooLarge {
length: usize,
max: usize,
},
InvalidPacketStatus(u8),
BufferOverflow {
needed: usize,
capacity: usize,
},
UnexpectedEof,
UnsupportedVersion(u32),
InvalidField {
field: &'static str,
value: u32,
},
}Expand description
Errors that can occur during TDS protocol parsing or encoding.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
IncompletePacket
Packet data is truncated or incomplete.
InvalidPacketType(u8)
Invalid packet type value.
InvalidTokenType(u8)
Invalid token type value.
InvalidDataType(u8)
Invalid data type value.
InvalidPreloginOption(u8)
Invalid prelogin option.
InvalidTdsVersion(u32)
Invalid TDS version.
StringEncoding(String)
String encoding error.
PacketTooLarge
Packet length exceeds maximum allowed.
InvalidPacketStatus(u8)
Invalid packet status flags.
BufferOverflow
Buffer overflow during encoding.
UnexpectedEof
Unexpected end of stream.
UnsupportedVersion(u32)
Protocol version mismatch.
InvalidField
Invalid field value in a protocol structure.
Implementations§
Source§impl ProtocolError
impl ProtocolError
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Check if this error is transient and may succeed on retry.
Protocol errors are almost always terminal — they indicate malformed data
or driver bugs. The only transient case is UnexpectedEof, which may
occur during connection loss.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if this error is terminal and will never succeed on retry.
Most protocol errors indicate a fundamental mismatch between client and server, a driver bug, or corrupted data.
Trait Implementations§
Source§impl Debug for ProtocolError
impl Debug for ProtocolError
Source§impl Display for ProtocolError
impl Display 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()