Skip to content

Commit 01f6498

Browse files
committed
feat(error): add Error::is_connect method
This allows inspecting errors to determine if they are from a client trying to establish a connection (from the `Connect`).
1 parent fd25129 commit 01f6498

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/error.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,6 @@ pub(crate) enum User {
9797
*/
9898

9999
impl Error {
100-
//TODO(error): should there be these kinds of inspection methods?
101-
//
102-
// - is_io()
103-
// - is_connect()
104-
// - is_closed()
105-
// - etc?
106-
107100
/// Returns true if this was an HTTP parse error.
108101
pub fn is_parse(&self) -> bool {
109102
match self.inner.kind {
@@ -139,6 +132,11 @@ impl Error {
139132
self.inner.kind == Kind::Closed
140133
}
141134

135+
/// Returns true if this was an error from `Connect`.
136+
pub fn is_connect(&self) -> bool {
137+
self.inner.kind == Kind::Connect
138+
}
139+
142140
/// Returns the error's cause.
143141
///
144142
/// This is identical to `Error::cause` except that it provides extra

0 commit comments

Comments
 (0)