#[non_exhaustive]pub enum ProtocolError {
InvalidMultibulkLength,
InvalidBulkLength,
ExpectedDollar(u8),
TooBigMbulkCount,
TooBigBulkCount,
TooBigInline,
UnbalancedQuotes,
UnknownType(u8),
TooDeep,
Unsupported(u8),
}Expand description
A frame the codec will not accept.
This is a value rather than a string because the connection has to do two things with it: write the Redis text to the client, and close the connection, which is what Redis does after any protocol error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidMultibulkLength
The * count was not an integer, was negative past what Redis allows,
or was larger than the multibulk limit.
InvalidBulkLength
The $ length was not an integer, was negative, or was larger than the
bulk limit.
ExpectedDollar(u8)
An argument did not begin with $. Carries the byte that was there
instead, because that byte is in the message Redis sends.
TooBigMbulkCount
The * count line has not ended and there is already more pending than
an inline request is allowed to be.
TooBigBulkCount
The $ length line has not ended and there is already more pending than
an inline request is allowed to be.
TooBigInline
An inline request has no newline and has passed the inline limit.
UnbalancedQuotes
An inline request opened a quote it never closed.
UnknownType(u8)
A reply began with a byte that is not a type in either protocol. Carries the byte.
TooDeep
A reply nested deeper than the configured limit. This is only reachable from the reply decoder, which is the one part of the codec that recurses.
Unsupported(u8)
A frame this build does not decode, currently the streamed aggregates and streamed strings. Carries the type byte.
Implementations§
Source§impl ProtocolError
impl ProtocolError
Sourcepub fn write_reply(&self, out: &mut Vec<u8>)
pub fn write_reply(&self, out: &mut Vec<u8>)
Appends the error line the client should see, - and CRLF included.
Written straight into the output buffer rather than returned as a
String, because the failure path runs on a shard thread too and a
shard thread that allocates aborts.
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 moreimpl Copy for ProtocolError
Source§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 From<ProtocolError> for Error
impl From<ProtocolError> for Error
Source§fn from(e: ProtocolError) -> Error
fn from(e: ProtocolError) -> Error
A protocol error reaching the typed API is an invalid argument, because on that side of the boundary the caller handed us the bytes.