Open SamuelMarks opened 4 years ago
The private http::error::ErrorKind
shouldn't be in your way, since http::Error
has is
and get_ref
for read access, and implements From<InvalidUri>
(if "percolate" includes creating them). However, I see that http::uri::InvalidUri
is itself opaque: not user constructable and only offers a description to read. Is that the real issue?
The prominent style here AFAICT, is to never expose a public enum
. This unfortunately tends to leave users with only a description string, but #303 demonstrates willingness to improve usability in other ways. Perhaps kind-specific constructor functions and is_<kind>(&self) -> bool
(e.g. is_invalid_format
) methods could be added to InvalidUri
?
@dekellum So how do I create a http::uri::InvalidUri
in my codebase?
I'm confused how to percolate errors from
http
through my library.I want to percolate up a
http::uri::ErrorKind::InvalidFormat
if.host()
isNone
.