Skip to content

Commit 5b7cf00

Browse files
committed
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.
1 parent d675a5e commit 5b7cf00

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

github/client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,11 @@ func reverseNormalizeHost(host string) string {
11561156

11571157
func checkStatus(expectedStatus int, action string, response *simpleResponse, err error) error {
11581158
if err != nil {
1159-
return fmt.Errorf("Error %s: %s", action, err.Error())
1159+
errStr := err.Error()
1160+
if urlErr, isURLErr := err.(*url.Error); isURLErr {
1161+
errStr = fmt.Sprintf("%s %s: %s", urlErr.Op, urlErr.URL, urlErr.Err)
1162+
}
1163+
return fmt.Errorf("Error %s: %s", action, errStr)
11601164
} else if response.StatusCode != expectedStatus {
11611165
errInfo, err := response.ErrorInfo()
11621166
if err != nil {

0 commit comments

Comments
 (0)