Open
Description
The Error
type in hyper is currently an enum
, wrapping up the various cases of things that could go wrong when parsing incoming HTTP data. Some of the problems with the current design:
- Being an
enum
means that adding variants is a breaking change. There is a__Nonexhaustive
variant to try to warn that exhaustive matches can cause breaking changes, but that it's better when internals are hidden. - Users sometimes try to create
hyper::Error
s, even though they really shouldn't. It is meant only for saying "this thing went wrong while hyper was parsing HTTP", and nothing else. Part of this can be fixed also by changing the actual error types used, such as in outgoingStream
s.
Instead, I'd like to propose making the Error
an opaque struct
, with some methods to inspect the type and details of an error, somewhat along the lines of std::io::Error
.
(Still thinking through the specific code, will add a design section later).