mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-02-28 22:03:00 +00:00
Try to generate HTTP error for gomatrixserverlib.NotAllowed
This commit is contained in:
parent
a28297c39d
commit
2e9a727620
1 changed files with 7 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/matrix-org/dendrite/federationsender/api"
|
||||
|
@ -115,6 +116,12 @@ func (r *FederationSenderInternalAPI) PerformJoin(
|
|||
// Clear the wrapped error, else serialising to JSON (in polylith mode) will fail
|
||||
httpErr.WrappedError = nil
|
||||
response.LastError = &httpErr
|
||||
} else if na, ok := lastErr.(*gomatrixserverlib.NotAllowed); ok {
|
||||
response.LastError = &gomatrix.HTTPError{
|
||||
Code: http.StatusForbidden,
|
||||
WrappedError: na,
|
||||
Message: na.Message,
|
||||
}
|
||||
} else {
|
||||
response.LastError = &gomatrix.HTTPError{
|
||||
Code: 0,
|
||||
|
|
Loading…
Reference in a new issue