1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use std::io;
/// Result alias used throughout the crate.
pub type Result<T> = std::result::Result<T, Error>;
/// Errors returned by the memcached client.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// The cache-service YAML or selected namespace was invalid.
#[error(transparent)]
CacheServiceConfig(#[from] crate::cacheservice::CacheServiceError),
/// Transport-level I/O error on an established connection.
#[error("io error: {0}")]
Io(#[source] io::Error),
/// An operation exceeded the configured timeout.
#[error("operation timed out")]
Timeout,
/// The physical node has not connected yet or is reconnecting.
#[error("backend connection is unavailable")]
Unavailable,
/// The physical node's bounded request queue is full.
#[error("backend request capacity is exhausted")]
Overloaded,
/// The server reported a `SERVER_ERROR` (text) or a server-side status.
#[error("server error: {0}")]
Server(String),
/// The server reported a `CLIENT_ERROR` / invalid-argument style failure.
#[error("client error: {0}")]
Client(String),
/// The response could not be parsed / violated the protocol.
#[error("protocol error: {0}")]
Protocol(String),
/// The connection is out of sync: a response frame did not match the
/// request that was sent (e.g. a leftover frame from a timed-out
/// operation). The connection must be dropped, not reused.
#[error("desynced connection: {0}")]
Desynced(String),
/// The key was empty, too long, or contained control/space characters.
#[error("invalid key: {0}")]
InvalidKey(&'static str),
/// A stored value used a feature this client does not decode
/// (QuickLZ compression or Java object serialization).
#[error("unsupported value encoding: {0}")]
Unsupported(&'static str),
/// A typed decode of a [`crate::Value`] did not match the stored flags.
#[error("value decode error: {0}")]
Decode(String),
}
impl From<io::Error> for Error {
fn from(err: io::Error) -> Self {
Error::Io(err)
}
}