File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,6 @@ pub(super) enum Kind {
56
56
/// The body write was aborted.
57
57
BodyWriteAborted ,
58
58
/// Error calling AsyncWrite::shutdown()
59
- #[ cfg( feature = "http1" ) ]
60
59
Shutdown ,
61
60
62
61
/// A general error from h2.
@@ -201,6 +200,11 @@ impl Error {
201
200
self . find_source :: < TimedOut > ( ) . is_some ( )
202
201
}
203
202
203
+ /// Returns true if the error was caused by a shutdown.
204
+ pub fn is_shutdown ( & self ) -> bool {
205
+ matches ! ( self . inner. kind, Kind :: Shutdown )
206
+ }
207
+
204
208
/// Consumes the error, returning its cause.
205
209
pub fn into_cause ( self ) -> Option < Box < dyn StdError + Send + Sync > > {
206
210
self . inner . cause
@@ -440,7 +444,6 @@ impl Error {
440
444
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
441
445
Kind :: BodyWrite => "error writing a body to connection" ,
442
446
Kind :: BodyWriteAborted => "body write aborted" ,
443
- #[ cfg( feature = "http1" ) ]
444
447
Kind :: Shutdown => "error shutting down connection" ,
445
448
#[ cfg( feature = "http2" ) ]
446
449
Kind :: Http2 => "http2 error" ,
You can’t perform that action at this time.
0 commit comments