Adjust default HTTPError stringifying

pull/133/head
Tulir Asokan 2023-06-14 14:49:46 +03:00
parent b723a36ec1
commit 79af7f968a
1 changed files with 2 additions and 2 deletions

View File

@ -95,9 +95,9 @@ func (e HTTPError) Error() string {
return fmt.Sprintf("failed to %s %s: %s (HTTP %d): %s", e.Request.Method, e.Request.URL.Path,
e.RespError.ErrCode, e.Response.StatusCode, e.RespError.Err)
} else {
msg := fmt.Sprintf("failed to %s %s: %s", e.Request.Method, e.Request.URL.Path, e.Response.Status)
msg := fmt.Sprintf("failed to %s %s: HTTP %d", e.Request.Method, e.Request.URL.Path, e.Response.StatusCode)
if len(e.ResponseBody) > 0 {
msg = fmt.Sprintf("%s\n%s", msg, e.ResponseBody)
msg = fmt.Sprintf("%s: %s", msg, e.ResponseBody)
}
return msg
}