blob: 63b45d37855213a3405047bdbde47a11ac97bcad (
plain)
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
|
use thiserror::Error as ThisError;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(ThisError, Debug)]
pub enum Error {
#[error(transparent)]
IO(#[from] std::io::Error),
#[error("Timeout Error")]
Timeout,
#[error("Path Not Found Error: {0}")]
PathNotFound(&'static str),
#[error("Channel Send Error: {0}")]
ChannelSend(String),
#[error(transparent)]
ChannelRecv(#[from] smol::channel::RecvError),
#[error(transparent)]
BincodeDecode(#[from] bincode::error::DecodeError),
#[error(transparent)]
BincodeEncode(#[from] bincode::error::EncodeError),
}
impl<T> From<smol::channel::SendError<T>> for Error {
fn from(error: smol::channel::SendError<T>) -> Self {
Error::ChannelSend(error.to_string())
}
}
|