blob: 2b8f6410e9d3d918ffd4e213cd58f66d4e77717b (
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
41
42
43
44
|
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),
#[cfg(feature = "tokio")]
#[error(transparent)]
TokioJoinError(#[from] tokio::task::JoinError),
#[error("Channel Send Error: {0}")]
ChannelSend(String),
#[error(transparent)]
ChannelRecv(#[from] async_channel::RecvError),
#[error(transparent)]
BincodeDecode(#[from] bincode::error::DecodeError),
#[error(transparent)]
BincodeEncode(#[from] bincode::error::EncodeError),
}
impl<T> From<async_channel::SendError<T>> for Error {
fn from(error: async_channel::SendError<T>) -> Self {
Error::ChannelSend(error.to_string())
}
}
|