diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2023-04-28 17:49:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-28 17:49:38 +0200 |
commit | 9e9617ff84c3310fa3db6f32cdfc0207ec546963 (patch) | |
tree | 13fc5313e782f05c4569d7e49bcaea4bf8229dab /clientapi/jsonerror/jsonerror.go | |
parent | 6b47cf0f6ac9176b7e5a5bd6f357722ee0f5e384 (diff) |
Add key backup tests (#3071)
Also slightly refactors the functions and methods to rely less on the
req/res pattern we had for polylith.
Returns `M_WRONG_ROOM_KEYS_VERSION` for some endpoints as per the spec
Diffstat (limited to 'clientapi/jsonerror/jsonerror.go')
-rw-r--r-- | clientapi/jsonerror/jsonerror.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clientapi/jsonerror/jsonerror.go b/clientapi/jsonerror/jsonerror.go index be7d13a9..436e168a 100644 --- a/clientapi/jsonerror/jsonerror.go +++ b/clientapi/jsonerror/jsonerror.go @@ -171,6 +171,23 @@ func LeaveServerNoticeError() *MatrixError { } } +// ErrRoomKeysVersion is an error returned by `PUT /room_keys/keys` +type ErrRoomKeysVersion struct { + MatrixError + CurrentVersion string `json:"current_version"` +} + +// WrongBackupVersionError is an error returned by `PUT /room_keys/keys` +func WrongBackupVersionError(currentVersion string) *ErrRoomKeysVersion { + return &ErrRoomKeysVersion{ + MatrixError: MatrixError{ + ErrCode: "M_WRONG_ROOM_KEYS_VERSION", + Err: "Wrong backup version.", + }, + CurrentVersion: currentVersion, + } +} + type IncompatibleRoomVersionError struct { RoomVersion string `json:"room_version"` Error string `json:"error"` |