1use thiserror::Error;
6
7#[derive(Debug, Error)]
9pub enum Error {
10 #[error("connection failed: {0}")]
12 ConnectionFailed(String),
13
14 #[error("timeout: {0}")]
16 Timeout(String),
17
18 #[error("authentication failed: {0}")]
20 AuthenticationFailed(String),
21
22 #[error("protocol error: {0}")]
24 Protocol(String),
25
26 #[error("I/O error: {0}")]
28 IoError(String),
29
30 #[error("device error: {0}")]
32 DeviceError(String),
33
34 #[error("parse error: {0}")]
36 ParseError(String),
37}
38
39impl From<std::io::Error> for Error {
40 fn from(err: std::io::Error) -> Self {
41 Error::IoError(err.to_string())
42 }
43}