hyper: A better Client Error experience
As discussed in #1128, there is good reason to consider having 2 different error types, and they would be useful for the Client
as well. The hyper::Error
is the correct error type for the Client
to return from its Future
, as well as from the response’s body stream.
However, It does not makes sense for the request body stream to require sending a hyper::Error
if generating the body failed. In that case, nothing in hyper failed, and the only relevant thing to hyper is that the stream cannot be completed. So the error type sent should be some sort of Disconnect
or Abort
or whatever, since an error on the body stream means the only thing hyper can reasonably do is to give up on the connection.
As in the server issue, the From<std::io::Error>
and From<hyper::Error>
implementations would be useful to allow easily sending streams from other sources, but it would be clear that the actual error type means “kill it dead.”
New proposal: #1431
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 15 (10 by maintainers)
Commits related to this issue
- feat(error): revamp `hyper::Error` type **The `Error` is now an opaque struct**, which allows for more variants to be added freely, and the internal representation to change without being breaking ch... — committed to hyperium/hyper by seanmonstar 6 years ago
- feat(error): revamp `hyper::Error` type **The `Error` is now an opaque struct**, which allows for more variants to be added freely, and the internal representation to change without being breaking ch... — committed to hyperium/hyper by seanmonstar 6 years ago
- feat(error): revamp `hyper::Error` type **The `Error` is now an opaque struct**, which allows for more variants to be added freely, and the internal representation to change without being breaking ch... — committed to hyperium/hyper by seanmonstar 6 years ago
- feat(error): revamp `hyper::Error` type **The `Error` is now an opaque struct**, which allows for more variants to be added freely, and the internal representation to change without being breaking ch... — committed to hyperium/hyper by seanmonstar 6 years ago
- feat(error): revamp `hyper::Error` type **The `Error` is now an opaque struct**, which allows for more variants to be added freely, and the internal representation to change without being breaking ch... — committed to hyperium/hyper by seanmonstar 6 years ago
One thing I’d like is to differentiate IO errors based on where they came from. I care about connect errors in particular, since you can retry the request on a different host if you can’t connect to one of them, even if the request isn’t idempotent or you have a body you can’t reset.