@@ -6,6 +6,7 @@ use std::io::Error as IoError;
6
6
use httparse;
7
7
use openssl:: ssl:: error:: SslError ;
8
8
use url;
9
+ use solicit:: http:: HttpError as Http2Error ;
9
10
10
11
use self :: Error :: {
11
12
Method ,
@@ -15,7 +16,8 @@ use self::Error::{
15
16
Status ,
16
17
Io ,
17
18
Ssl ,
18
- TooLarge
19
+ TooLarge ,
20
+ Http2 ,
19
21
} ;
20
22
21
23
@@ -40,7 +42,9 @@ pub enum Error {
40
42
/// An `io::Error` that occurred while trying to read or write to a network stream.
41
43
Io ( IoError ) ,
42
44
/// An error from the `openssl` library.
43
- Ssl ( SslError )
45
+ Ssl ( SslError ) ,
46
+ /// An HTTP/2-specific error, coming from the `solicit` library.
47
+ Http2 ( Http2Error ) ,
44
48
}
45
49
46
50
impl fmt:: Display for Error {
@@ -60,6 +64,7 @@ impl StdError for Error {
60
64
Uri ( ref e) => e. description ( ) ,
61
65
Io ( ref e) => e. description ( ) ,
62
66
Ssl ( ref e) => e. description ( ) ,
67
+ Http2 ( ref e) => e. description ( ) ,
63
68
}
64
69
}
65
70
@@ -68,6 +73,7 @@ impl StdError for Error {
68
73
Io ( ref error) => Some ( error) ,
69
74
Ssl ( ref error) => Some ( error) ,
70
75
Uri ( ref error) => Some ( error) ,
76
+ Http2 ( ref error) => Some ( error) ,
71
77
_ => None ,
72
78
}
73
79
}
@@ -108,12 +114,19 @@ impl From<httparse::Error> for Error {
108
114
}
109
115
}
110
116
117
+ impl From < Http2Error > for Error {
118
+ fn from ( err : Http2Error ) -> Error {
119
+ Error :: Http2 ( err)
120
+ }
121
+ }
122
+
111
123
#[ cfg( test) ]
112
124
mod tests {
113
125
use std:: error:: Error as StdError ;
114
126
use std:: io;
115
127
use httparse;
116
128
use openssl:: ssl:: error:: SslError ;
129
+ use solicit:: http:: HttpError as Http2Error ;
117
130
use url;
118
131
use super :: Error ;
119
132
use super :: Error :: * ;
@@ -156,6 +169,7 @@ mod tests {
156
169
from_and_cause ! ( io:: Error :: new( io:: ErrorKind :: Other , "other" ) => Io ( ..) ) ;
157
170
from_and_cause ! ( url:: ParseError :: EmptyHost => Uri ( ..) ) ;
158
171
from_and_cause ! ( SslError :: SslSessionClosed => Ssl ( ..) ) ;
172
+ from_and_cause ! ( Http2Error :: UnknownStreamId => Http2 ( ..) ) ;
159
173
160
174
from ! ( SslError :: StreamError ( io:: Error :: new( io:: ErrorKind :: Other , "ssl negotiation" ) ) => Io ( ..) ) ;
161
175
0 commit comments