diff --git a/federationapi/inthttp/server.go b/federationapi/inthttp/server.go index 02d4bc3c6..a8b829a71 100644 --- a/federationapi/inthttp/server.go +++ b/federationapi/inthttp/server.go @@ -221,11 +221,10 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) { ) } -func federationClientError(err error) *api.FederationClientError { - if err == nil { - return nil - } +func federationClientError(err error) error { switch ferr := err.(type) { + case nil: + return nil case api.FederationClientError: return &ferr case *api.FederationClientError: diff --git a/internal/httputil/http.go b/internal/httputil/http.go index a700c9684..1e07ee33c 100644 --- a/internal/httputil/http.go +++ b/internal/httputil/http.go @@ -78,7 +78,7 @@ func PostJSON[reqtype, restype any, errtype error]( } if res.StatusCode != http.StatusOK { if len(body) == 0 { - return fmt.Errorf("HTTP %d from %s", res.StatusCode, apiURL) + return fmt.Errorf("HTTP %d from %s (no response body)", res.StatusCode, apiURL) } var reserr errtype if err = json.Unmarshal(body, reserr); err != nil {