hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Include connection info in Client::send_request errors

Open nox opened this issue 3 years ago • 5 comments

nox avatar Feb 04 '22 10:02 nox

@seanmonstar Ping on this?

nox avatar Mar 23 '22 09:03 nox

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 the hyper::Error? I could imagine we want to attach other useful things in the future, so what mechanism should that use?

seanmonstar avatar Mar 23 '22 18:03 seanmonstar

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?

nox avatar Mar 30 '22 13:03 nox

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?

seanmonstar avatar May 26 '22 23:05 seanmonstar

SGTM, that’s at least one less patch to maintain on my side until 1.0 :)

nox avatar May 27 '22 12:05 nox

@seanmonstar Would you merge it if I rebase it again?

nox avatar Apr 03 '23 09:04 nox

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).

seanmonstar avatar Apr 03 '23 19:04 seanmonstar

I rebased it on top of 0.14.x and changed the PR base branch.

nox avatar Apr 14 '23 08:04 nox