提交 5b7cf00a 编写于 作者: M Mislav Marohnić

Normalize `url.Error` message for Go 1.14

Go 1.13: `Post <URL>: <message>`
Go 1.14: `Post "<URL>": <message>`

Since we have an existing test that includes this error message, make
sure that `url.Error`s are output without quotes around the URL.
上级 d675a5ed
......@@ -1156,7 +1156,11 @@ func reverseNormalizeHost(host string) string {
func checkStatus(expectedStatus int, action string, response *simpleResponse, err error) error {
if err != nil {
return fmt.Errorf("Error %s: %s", action, err.Error())
errStr := err.Error()
if urlErr, isURLErr := err.(*url.Error); isURLErr {
errStr = fmt.Sprintf("%s %s: %s", urlErr.Op, urlErr.URL, urlErr.Err)
}
return fmt.Errorf("Error %s: %s", action, errStr)
} else if response.StatusCode != expectedStatus {
errInfo, err := response.ErrorInfo()
if err != nil {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册