jsonerror

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InternalAPIError added in v0.9.2

func InternalAPIError(ctx context.Context, err error) util.JSONResponse

InternalAPIError is returned when Dendrite failed to reach an internal API.

func InternalServerError

func InternalServerError() util.JSONResponse

InternalServerError returns a 500 Internal Server Error in a matrix-compliant format.

Types

type IncompatibleRoomVersionError

type IncompatibleRoomVersionError struct {
	RoomVersion string `json:"room_version"`
	Error       string `json:"error"`
	Code        string `json:"errcode"`
}

func IncompatibleRoomVersion

func IncompatibleRoomVersion(roomVersion gomatrixserverlib.RoomVersion) *IncompatibleRoomVersionError

IncompatibleRoomVersion is an error which is returned when the client requests a room with a version that is unsupported.

type LimitExceededError

type LimitExceededError struct {
	MatrixError
	RetryAfterMS int64 `json:"retry_after_ms,omitempty"`
}

LimitExceededError is a rate-limiting error.

func LimitExceeded

func LimitExceeded(msg string, retryAfterMS int64) *LimitExceededError

LimitExceeded is an error when the client tries to send events too quickly.

type MatrixError

type MatrixError struct {
	ErrCode string `json:"errcode"`
	Err     string `json:"error"`
}

MatrixError represents the "standard error response" in Matrix. http://matrix.org/docs/spec/client_server/r0.2.0.html#api-standards

func ASExclusive

func ASExclusive(msg string) *MatrixError

ASExclusive is an error returned when an application service tries to register an username that is outside of its registered namespace, or if a user attempts to register a username or room alias within an exclusive namespace.

func BadAlias added in v0.7.0

func BadAlias(msg string) *MatrixError

BadAlias is an error when the client supplies a bad alias.

func BadJSON

func BadJSON(msg string) *MatrixError

BadJSON is an error when the client supplies malformed JSON.

func Forbidden

func Forbidden(msg string) *MatrixError

Forbidden is an error when the client tries to access a resource they are not allowed to access.

func GuestAccessForbidden

func GuestAccessForbidden(msg string) *MatrixError

GuestAccessForbidden is an error which is returned when the client is forbidden from accessing a resource as a guest.

func InvalidArgumentValue

func InvalidArgumentValue(msg string) *MatrixError

InvalidArgumentValue is an error when the client tries to provide an invalid value for a valid argument

func InvalidParam added in v0.5.0

func InvalidParam(msg string) *MatrixError

InvalidParam is an error that is returned when a parameter was invalid, traditionally with cross-signing.

func InvalidSignature added in v0.5.0

func InvalidSignature(msg string) *MatrixError

InvalidSignature is an error which is returned when the client tries to upload invalid signatures.

func InvalidUsername

func InvalidUsername(msg string) *MatrixError

InvalidUsername is an error returned when the client tries to register an invalid username

func LeaveServerNoticeError added in v0.6.4

func LeaveServerNoticeError() *MatrixError

LeaveServerNoticeError is an error returned when trying to reject an invite for a server notice room.

func MissingArgument

func MissingArgument(msg string) *MatrixError

MissingArgument is an error when the client tries to access a resource without providing an argument that is required.

func MissingParam added in v0.5.0

func MissingParam(msg string) *MatrixError

MissingParam is an error that is returned when a parameter was incorrect, traditionally with cross-signing.

func MissingToken

func MissingToken(msg string) *MatrixError

MissingToken is an error when the client tries to access a resource which requires authentication without supplying credentials.

func NotFound

func NotFound(msg string) *MatrixError

NotFound is an error when the client tries to access an unknown resource.

func NotJSON

func NotJSON(msg string) *MatrixError

NotJSON is an error when the client supplies something that is not JSON to a JSON endpoint.

func NotTrusted

func NotTrusted(serverName string) *MatrixError

NotTrusted is an error which is returned when the client asks the server to proxy a request (e.g. 3PID association) to a server that isn't trusted

func RoomInUse added in v0.5.0

func RoomInUse(msg string) *MatrixError

RoomInUse is an error returned when the client tries to make a room that already exists

func UnableToAuthoriseJoin added in v0.8.6

func UnableToAuthoriseJoin(msg string) *MatrixError

UnableToAuthoriseJoin is an error that is returned when a server can't determine whether to allow a restricted join or not.

func Unknown

func Unknown(msg string) *MatrixError

Unknown is an unexpected error

func UnknownToken

func UnknownToken(msg string) *MatrixError

UnknownToken is an error when the client tries to access a resource which requires authentication and supplies an unrecognised token

func UnsupportedRoomVersion

func UnsupportedRoomVersion(msg string) *MatrixError

UnsupportedRoomVersion is an error which is returned when the client requests a room with a version that is unsupported.

func UserInUse

func UserInUse(msg string) *MatrixError

UserInUse is an error returned when the client tries to register an username that already exists

func WeakPassword

func WeakPassword(msg string) *MatrixError

WeakPassword is an error which is returned when the client tries to register using a weak password. http://matrix.org/docs/spec/client_server/r0.2.0.html#password-based

func (MatrixError) Error

func (e MatrixError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL