mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
error: don't include path in HTTP errors
Some checks failed
Some checks failed
The request data is logged anyway, so it's nicer if the error string only has the important part.
This commit is contained in:
parent
6c9a29d25a
commit
918ed4bf23
1 changed files with 2 additions and 3 deletions
5
error.go
5
error.go
|
|
@ -96,10 +96,9 @@ func (e HTTPError) Error() string {
|
|||
if e.WrappedError != nil {
|
||||
return fmt.Sprintf("%s: %v", e.Message, e.WrappedError)
|
||||
} else if e.RespError != nil {
|
||||
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)
|
||||
return fmt.Sprintf("%s (HTTP %d): %s", e.RespError.ErrCode, e.Response.StatusCode, e.RespError.Err)
|
||||
} else {
|
||||
msg := fmt.Sprintf("failed to %s %s: HTTP %d", e.Request.Method, e.Request.URL.Path, e.Response.StatusCode)
|
||||
msg := fmt.Sprintf("HTTP %d", e.Response.StatusCode)
|
||||
if len(e.ResponseBody) > 0 {
|
||||
msg = fmt.Sprintf("%s: %s", msg, e.ResponseBody)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue