blob: cc60696f6ae0ce5a3e3f2355355a1909f2422d81 (
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
34
35
36
37
38
39
40
|
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("TryInto Error: {0}")]
TryInto(&'static str),
#[error("Timeout Error")]
Timeout,
#[error("Path Not Found Error: {0}")]
PathNotFound(&'static str),
#[cfg(feature = "crypto")]
#[error(transparent)]
Ed25519(#[from] ed25519_dalek::ed25519::Error),
#[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())
}
}
|