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
use std::io;
use std::num::ParseIntError;

/// Error
#[derive(thiserror::Error, Debug)]
pub enum Error {
    /// Server failed to parse the command
    #[error("Invalid command or arguments")]
    CommandError { msg: String },

    /// The server closed the connection
    #[error("The server closed the connection")]
    Disconnected,

    /// Represents all other cases of `std::io::Error`.
    #[error(transparent)]
    IOError(#[from] io::Error),

    /// TODO
    #[error("Server error")]
    ServerError { msg: String },

    /// Generic unexpected response error
    #[error("invalid value error")]
    ValueError { msg: String },

    /// Conversion error
    #[error(transparent)]
    ParseInteError(#[from] ParseIntError),
}