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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
use std::{error, fmt};
#[derive(Debug, Eq, PartialEq)]
pub enum Error {
InvalidVersion,
InvalidMsgType,
SessionShutdown,
StreamsExhausted,
DuplicateStream,
RecvWindowExceeded,
Timeout,
StreamClosed,
UnexpectedFlag,
RemoteGoAway,
ConnectionReset,
ConnectionWriteTimeout,
KeepAliveTimeout,
SubStreamRemoteClosing,
WouldBlock,
}
impl error::Error for Error {}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Error::InvalidVersion => write!(f, "Received a frame with an invalid version"),
Error::InvalidMsgType => write!(f, "Received a frame with an invalid message type"),
Error::SessionShutdown => write!(f, "Session shutdown"),
Error::StreamsExhausted => write!(f, "No more stream ids to issue"),
Error::DuplicateStream => write!(f, "Duplicate stream is opened inbound"),
Error::RecvWindowExceeded => write!(f, "Received window was exceeded"),
Error::Timeout => write!(f, "Reach an IO deadline"),
Error::StreamClosed => write!(f, "Using a closed stream"),
Error::UnexpectedFlag => write!(f, "Get an unexpected flag"),
Error::RemoteGoAway => write!(f, "Go away message from the other side"),
Error::ConnectionReset => write!(f, "Stream is reset"),
Error::ConnectionWriteTimeout => {
write!(f, "Timeout on write to the underlying stream connection")
}
Error::KeepAliveTimeout => write!(f, "Keepalive timeout"),
Error::SubStreamRemoteClosing => write!(f, "Remote sub stream is closed"),
Error::WouldBlock => write!(f, "Sub stream send channel full"),
}
}
}