1use thiserror::Error;
2
3#[derive(Debug, Error)]
5#[non_exhaustive]
6pub enum RespError {
7    #[error("unexpected end of input")]
9    EndOfInput,
10
11    #[error("invalid boolean")]
13    InvalidBoolean,
14
15    #[error("invalid blob length")]
17    InvalidBlobLength,
18
19    #[error("invalid double")]
21    InvalidDouble,
22
23    #[error("invalid integer")]
25    InvalidInteger,
26
27    #[error("invalid map")]
29    InvalidMap,
30
31    #[error("invalid set")]
33    InvalidSet,
34
35    #[error("invalid verbatim")]
37    InvalidVerbatim,
38
39    #[error("io error")]
41    IO(#[from] std::io::Error),
42
43    #[error("newline is not allowed in this frame")]
45    Newline,
46
47    #[error("unsupported in the current version")]
49    Version,
50
51    #[error("map keys and set values must be primitives")]
53    RespPrimitive,
54
55    #[error("too big inline request")]
57    TooBigInline,
58
59    #[error("expected {:?}, got {:?}", char::from(*.0), char::from(*.1))]
61    Unexpected(u8, u8),
62
63    #[error("unknown resp type: {:?}", char::from(*.0))]
65    UnknownType(u8),
66
67    #[error("invalid inline command")]
69    InvalidInline,
70}