mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-09 07:03:10 -06:00
Tweak federation client proxying
This commit is contained in:
parent
b099e7cb75
commit
11802a007e
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue