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

View file

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