pub struct Error { /* private fields */ }Expand description
Represents a valkey error. For the most part you should be using the Error trait to interact with this rather than the actual struct.
Implementations§
Source§impl Error
Indicates a general failure in the library.
impl Error
Indicates a general failure in the library.
Sourcepub fn err_code(&self) -> &str
pub fn err_code(&self) -> &str
Returns the raw error code if available. Returns the error code string (e.g. “MOVED”, “ERR”, “WRONGTYPE”). Equivalent to the old ServerError::err_code() — returns empty string if no code.
pub fn code(&self) -> Option<&str>
Sourcepub fn is_io_error(&self) -> bool
pub fn is_io_error(&self) -> bool
Indicates that this failure is an IO failure.
Sourcepub fn is_cluster_error(&self) -> bool
pub fn is_cluster_error(&self) -> bool
Indicates that this is a cluster error.
Sourcepub fn is_connection_refusal(&self) -> bool
pub fn is_connection_refusal(&self) -> bool
Returns true if this error indicates that the connection was refused. You should generally not rely much on this function unless you are writing unit tests that want to detect if a local server is available.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Returns true if error was caused by I/O time out. Note that this may not be accurate depending on platform.
Sourcepub fn is_connection_dropped(&self) -> bool
pub fn is_connection_dropped(&self) -> bool
Returns true if error was caused by a dropped connection.
Sourcepub fn is_unrecoverable_error(&self) -> bool
pub fn is_unrecoverable_error(&self) -> bool
Returns true if the error is likely to not be recoverable, and the connection must be replaced.
Sourcepub fn redirect_node(&self) -> Option<(&str, u16)>
pub fn redirect_node(&self) -> Option<(&str, u16)>
Returns the node the error refers to.
This returns (addr, slot_id).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§fn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
replaced by Error::source, which can support downcasting
Source§impl From<FromUtf8Error> for Error
impl From<FromUtf8Error> for Error
Source§fn from(_: FromUtf8Error) -> Error
fn from(_: FromUtf8Error) -> Error
Source§impl From<InvalidDnsNameError> for Error
impl From<InvalidDnsNameError> for Error
Source§fn from(err: InvalidDnsNameError) -> Error
fn from(err: InvalidDnsNameError) -> Error
Source§impl From<ParseIntError> for Error
impl From<ParseIntError> for Error
Source§fn from(_: ParseIntError) -> Error
fn from(_: ParseIntError) -> Error
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe for Error
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more