mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03:00
Move json errors over to gmsl (#3080)
This commit is contained in:
parent
a49c9f01e2
commit
0489d16f95
109 changed files with 808 additions and 1217 deletions
|
@ -20,13 +20,13 @@ import (
|
|||
"github.com/matrix-org/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/matrix-org/dendrite/clientapi/jsonerror"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
"github.com/matrix-org/dendrite/syncapi/internal"
|
||||
"github.com/matrix-org/dendrite/syncapi/storage"
|
||||
"github.com/matrix-org/dendrite/syncapi/synctypes"
|
||||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||
"github.com/matrix-org/gomatrixserverlib/spec"
|
||||
)
|
||||
|
||||
// GetEvent implements
|
||||
|
@ -51,13 +51,13 @@ func GetEvent(
|
|||
})
|
||||
if err != nil {
|
||||
logger.WithError(err).Error("GetEvent: syncDB.NewDatabaseTransaction failed")
|
||||
return jsonerror.InternalServerError()
|
||||
return spec.InternalServerError()
|
||||
}
|
||||
|
||||
events, err := db.Events(ctx, []string{eventID})
|
||||
if err != nil {
|
||||
logger.WithError(err).Error("GetEvent: syncDB.Events failed")
|
||||
return jsonerror.InternalServerError()
|
||||
return spec.InternalServerError()
|
||||
}
|
||||
|
||||
// The requested event does not exist in our database
|
||||
|
@ -65,7 +65,7 @@ func GetEvent(
|
|||
logger.Debugf("GetEvent: requested event doesn't exist locally")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusNotFound,
|
||||
JSON: jsonerror.NotFound("The event was not found or you do not have permission to read this event"),
|
||||
JSON: spec.NotFound("The event was not found or you do not have permission to read this event"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ func GetEvent(
|
|||
logger.WithError(err).Error("GetEvent: internal.ApplyHistoryVisibilityFilter failed")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusInternalServerError,
|
||||
JSON: jsonerror.InternalServerError(),
|
||||
JSON: spec.InternalServerError(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ func GetEvent(
|
|||
logger.WithField("event_count", len(events)).Debug("GetEvent: can't return the requested event")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusNotFound,
|
||||
JSON: jsonerror.NotFound("The event was not found or you do not have permission to read this event"),
|
||||
JSON: spec.NotFound("The event was not found or you do not have permission to read this event"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue