Don't wrap errors

This commit is contained in:
Kegan Dougal 2020-06-17 13:14:59 +01:00
parent f3bf6eb9f2
commit 61363c00f4
2 changed files with 4 additions and 9 deletions

View file

@ -28,10 +28,6 @@ import (
"github.com/matrix-org/util"
)
type JoinError struct {
Error interface{}
}
// MakeJoin implements the /make_join API
func MakeJoin(
httpReq *http.Request,
@ -228,9 +224,7 @@ func SendJoin(
if verifyResults[0].Error != nil {
return util.JSONResponse{
Code: http.StatusForbidden,
JSON: JoinError{
Error: jsonerror.Forbidden("Signature check failed: " + verifyResults[0].Error.Error()),
},
JSON: jsonerror.Forbidden("Signature check failed: " + verifyResults[0].Error.Error()),
}
}

View file

@ -18,6 +18,7 @@ import (
"net/http"
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
eduserverAPI "github.com/matrix-org/dendrite/eduserver/api"
federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api"
"github.com/matrix-org/dendrite/internal/config"
@ -208,9 +209,9 @@ func Setup(
body = []interface{}{
res.Code, res.JSON,
}
jerr, ok := res.JSON.(JoinError)
jerr, ok := res.JSON.(*jsonerror.MatrixError)
if ok {
body = jerr.Error
body = jerr
}
return util.JSONResponse{