Pass underlying network error in ErrorConnectionFailed#41292
Pass underlying network error in ErrorConnectionFailed#41292thaJeztah merged 1 commit intomoby:masterfrom
Conversation
client/request.go
Outdated
There was a problem hiding this comment.
I'm a bit concerned about adding the raw error after already trying to check what's the cause in this block.
You mentioned you had a deadline exceeded; wouldn't that already be return the raw error (handled higher up in this file)?
Lines 135 to 140 in 663d143
There was a problem hiding this comment.
net/http.Client.Do returns url.Error with Err error field being set to context.DeadlineExceeded error, so it passes through this switch
Maybe it's needed to try to Unwrap it first
There was a problem hiding this comment.
Yes, if it doesn't catch that, that may be a bug
Signed-off-by: Evgeniy Makhrov <e.makhrov@corp.badoo.com>
6f53815 to
8ccb46a
Compare
|
@thaJeztah could you please have a look. I've force-pushed to same PR and updated description. |
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM, did this solve the problem in your situation?
Yes, I've checked with context having enough timeout and exceeded deadline. It now shows me nice error that communication with docker.sock failed due to "context deadline exceeded" error |
- What I did
I changed the check for context error returned by net/http.Client.Do
- How I did it
by using github.com/pkg/errors.Is that searches for desired error in err's chain
- How to verify it
I've encountered shallow error message telling me to check if docker daemon is running but actual problem was in context deadline exceeding. To verify pass to client a context with a deadline that is in the past.
- Description for the changelog
Fixes context errors being treated as connectivity error in client
- A picture of a cute animal (not mandatory but encouraged)
Signed-off-by: Evgeniy Makhrov e.makhrov@corp.badoo.com