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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use crate::{
consensus::ConsensusError,
network::{message::MessageError, ConnectError},
objects::BlockError,
};
#[derive(Debug, Error)]
pub enum SendError {
#[error("{}: {}", _0, _1)]
Crate(&'static str, String),
#[error("{}", _0)]
ConnectError(ConnectError),
#[error("{}", _0)]
ConsensusError(ConsensusError),
#[error("{}", _0)]
Message(String),
#[error("{}", _0)]
MessageError(MessageError),
#[error("{}", _0)]
BlockError(BlockError),
}
impl From<BlockError> for SendError {
fn from(error: BlockError) -> Self {
SendError::BlockError(error)
}
}
impl From<ConnectError> for SendError {
fn from(error: ConnectError) -> Self {
SendError::ConnectError(error)
}
}
impl From<ConsensusError> for SendError {
fn from(error: ConsensusError) -> Self {
SendError::ConsensusError(error)
}
}
impl From<MessageError> for SendError {
fn from(error: MessageError) -> Self {
SendError::MessageError(error)
}
}