Browse Source

Merge pull request #41292 from eelf/pass_network_error

Pass underlying network error in ErrorConnectionFailed
Sebastiaan van Stijn 5 years ago
parent
commit
3f9876e631
1 changed files with 1 additions and 2 deletions
  1. 1 2
      client/request.go

+ 1 - 2
client/request.go

@@ -134,8 +134,7 @@ func (cli *Client) doRequest(ctx context.Context, req *http.Request) (serverResp
 
 
 		// Don't decorate context sentinel errors; users may be comparing to
 		// Don't decorate context sentinel errors; users may be comparing to
 		// them directly.
 		// them directly.
-		switch err {
-		case context.Canceled, context.DeadlineExceeded:
+		if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
 			return serverResp, err
 			return serverResp, err
 		}
 		}