Add HTTP status code to FederationClientError (#2699)

Also ensures we wait on more HTTP status codes.
This commit is contained in:
Till 2022-09-07 16:14:09 +02:00 committed by GitHub
parent 7e8c605f98
commit 0d697f6754
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 12 deletions

View file

@ -6,10 +6,12 @@ import (
"net/http"
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/federationapi/api"
"github.com/matrix-org/dendrite/internal/httputil"
"github.com/matrix-org/gomatrix"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util"
"github.com/matrix-org/dendrite/federationapi/api"
"github.com/matrix-org/dendrite/internal/httputil"
)
// AddRoutes adds the FederationInternalAPI handlers to the http.ServeMux.
@ -229,6 +231,10 @@ func federationClientError(err error) error {
return &ferr
case *api.FederationClientError:
return ferr
case gomatrix.HTTPError:
return &api.FederationClientError{
Code: ferr.Code,
}
default:
return &api.FederationClientError{
Err: err.Error(),