diff --git a/src/error.rs b/src/error.rs index d79b6f4376..226dee4a4d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -97,13 +97,6 @@ pub(crate) enum User { */ impl Error { - //TODO(error): should there be these kinds of inspection methods? - // - // - is_io() - // - is_connect() - // - is_closed() - // - etc? - /// Returns true if this was an HTTP parse error. pub fn is_parse(&self) -> bool { match self.inner.kind { @@ -139,6 +132,11 @@ impl Error { self.inner.kind == Kind::Closed } + /// Returns true if this was an error from `Connect`. + pub fn is_connect(&self) -> bool { + self.inner.kind == Kind::Connect + } + /// Returns the error's cause. /// /// This is identical to `Error::cause` except that it provides extra