jsonerror

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 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 InvalidUsername

func InvalidUsername(msg string) *MatrixError

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

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 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 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