Include connection info in Client::send_request errors
@seanmonstar Ping on this?
I think including this info in the error somehow is a good goal. We should do it. I want to figure out how exactly that info should be exposed, though. As part of 1.0, the pooling Client will likely get moved out and broken up, with most pieces probably in hyper-util. So, how do we expose this info?
- We could have a unique error type coming from the pooling client, which is essentially
enum SendError<E> { Connect(E), Http(hyper::Error) }. In that case, the info could just be part of the generic "connect" error. - Or we could reuse
hyper::Error, having the connect variant be internal somehow. In that case, how do we attach this useful extra information to thehyper::Error? I could imagine we want to attach other useful things in the future, so what mechanism should that use?
IMO for now 2nd way is good, as the client still lives in Hyper. Would you mind we merge this PR as is and see how we do it for 1.0 later?
So, I could just click merge, but it will most likely be different with 1.0 (and that's starting now-ish). How do you feel now?
SGTM, that’s at least one less patch to maintain on my side until 1.0 :)
@seanmonstar Would you merge it if I rebase it again?
Sure, we can just merge it into 0.14, while noting that a more generic mechanism is probably better for hyper-util (in a hyper 1.0 world).
I rebased it on top of 0.14.x and changed the PR base branch.