mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-10 23:53:09 -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 {
|
func federationClientError(err error) error {
|
||||||
if err == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
switch ferr := err.(type) {
|
switch ferr := err.(type) {
|
||||||
|
case nil:
|
||||||
|
return nil
|
||||||
case api.FederationClientError:
|
case api.FederationClientError:
|
||||||
return &ferr
|
return &ferr
|
||||||
case *api.FederationClientError:
|
case *api.FederationClientError:
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ func PostJSON[reqtype, restype any, errtype error](
|
||||||
}
|
}
|
||||||
if res.StatusCode != http.StatusOK {
|
if res.StatusCode != http.StatusOK {
|
||||||
if len(body) == 0 {
|
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
|
var reserr errtype
|
||||||
if err = json.Unmarshal(body, reserr); err != nil {
|
if err = json.Unmarshal(body, reserr); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue