Enum ErrorKind
#[non_exhaustive]pub enum ErrorKind {
Show 48 variants
BadAlias,
BadJson,
BadState,
BadStatus {
status: Option<StatusCode>,
body: Option<String>,
},
CannotLeaveServerNoticeRoom,
CannotOverwriteMedia,
CaptchaInvalid,
CaptchaNeeded,
ConnectionFailed,
ConnectionTimeout,
DuplicateAnnotation,
Exclusive,
Forbidden {
authenticate: Option<AuthenticateError>,
},
GuestAccessForbidden,
IncompatibleRoomVersion {
room_version: RoomVersionId,
},
InvalidParam,
InvalidRoomState,
InvalidUsername,
LimitExceeded {
retry_after: Option<RetryAfter>,
},
MissingParam,
MissingToken,
NotFound,
NotJson,
NotYetUploaded,
ResourceLimitExceeded {
admin_contact: String,
},
RoomInUse,
ServerNotTrusted,
ThreepidAuthFailed,
ThreepidDenied,
ThreepidInUse,
ThreepidMediumNotSupported,
ThreepidNotFound,
TooLarge,
UnableToAuthorizeJoin,
UnableToGrantJoin,
Unauthorized,
Unknown,
UnknownPos,
UnknownToken {
soft_logout: bool,
},
Unrecognized,
UnsupportedRoomVersion,
UrlNotSet,
UserDeactivated,
UserInUse,
UserLocked,
UserSuspended,
WeakPassword,
WrongRoomKeysVersion {
current_version: Option<String>,
},
}
api
and (crate features client
or server
) only.Expand description
An enum for the error kind.
Items may contain additional information.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BadAlias
M_BAD_ALIAS
One or more room aliases within the m.room.canonical_alias
event do not point to the
room ID for which the state event is to be sent to.
BadJson
M_BAD_JSON
The request contained valid JSON, but it was malformed in some way, e.g. missing required keys, invalid values for keys.
BadState
M_BAD_STATE
The state change requested cannot be performed, such as attempting to unban a user who is not banned.
BadStatus
M_BAD_STATUS
The application service returned a bad status.
Fields
status: Option<StatusCode>
The HTTP status code of the response.
CannotLeaveServerNoticeRoom
M_CANNOT_LEAVE_SERVER_NOTICE_ROOM
The user is unable to reject an invite to join the server notices room.
CannotOverwriteMedia
M_CANNOT_OVERWRITE_MEDIA
The create_content_async
endpoint was called with a media ID that already has content.
CaptchaInvalid
M_CAPTCHA_INVALID
The Captcha provided did not match what was expected.
CaptchaNeeded
M_CAPTCHA_NEEDED
A Captcha is required to complete the request.
ConnectionFailed
M_CONNECTION_FAILED
The connection to the application service failed.
ConnectionTimeout
M_CONNECTION_TIMEOUT
The connection to the application service timed out.
DuplicateAnnotation
M_DUPLICATE_ANNOTATION
The request is an attempt to send a duplicate annotation.
Exclusive
M_EXCLUSIVE
The resource being requested is reserved by an application service, or the application service making the request has not created the resource.
Forbidden
M_FORBIDDEN
Forbidden access, e.g. joining a room without permission, failed login.
Fields
This variant is marked as non-exhaustive
authenticate: Option<AuthenticateError>
unstable-msc2967
only.The WWW-Authenticate
header error message.
GuestAccessForbidden
M_GUEST_ACCESS_FORBIDDEN
The room or resource does not permit guests to access it.
IncompatibleRoomVersion
M_INCOMPATIBLE_ROOM_VERSION
The client attempted to join a room that has a version the server does not support.
Fields
room_version: RoomVersionId
The room’s version.
InvalidParam
M_INVALID_PARAM
A parameter that was specified has the wrong value. For example, the server expected an integer and instead received a string.
InvalidRoomState
M_INVALID_ROOM_STATE
The initial state implied by the parameters to the create_room
request is invalid, e.g.
the user’s power_level
is set below that necessary to set the room name.
InvalidUsername
M_INVALID_USERNAME
The desired user name is not valid.
LimitExceeded
M_LIMIT_EXCEEDED
The request has been refused due to rate limiting: too many requests have been sent in a short period of time.
Fields
retry_after: Option<RetryAfter>
How long a client should wait before they can try again.
MissingParam
M_MISSING_PARAM
A required parameter was missing from the request.
MissingToken
M_MISSING_TOKEN
No access token was specified for the request, but one is required.
NotFound
M_NOT_FOUND
No resource was found for this request.
NotJson
M_NOT_JSON
The request did not contain valid JSON.
NotYetUploaded
M_NOT_YET_UPLOADED
An mxc:
URI generated with the create_mxc_uri
endpoint was used and the content is
not yet available.
ResourceLimitExceeded
M_RESOURCE_LIMIT_EXCEEDED
The request cannot be completed because the homeserver has reached a resource limit imposed on it. For example, a homeserver held in a shared hosting environment may reach a resource limit if it starts using too much memory or disk space.
RoomInUse
M_ROOM_IN_USE
The room alias specified in the create_room
request is already taken.
ServerNotTrusted
M_SERVER_NOT_TRUSTED
The client’s request used a third-party server, e.g. identity server, that this server does not trust.
ThreepidAuthFailed
M_THREEPID_AUTH_FAILED
Authentication could not be performed on the third-party identifier.
ThreepidDenied
M_THREEPID_DENIED
The server does not permit this third-party identifier. This may happen if the server only permits, for example, email addresses from a particular domain.
ThreepidInUse
M_THREEPID_IN_USE
The third-party identifier is already in use by another user.
ThreepidMediumNotSupported
M_THREEPID_MEDIUM_NOT_SUPPORTED
The homeserver does not support adding a third-party identifier of the given medium.
ThreepidNotFound
M_THREEPID_NOT_FOUND
No account matching the given third-party identifier could be found.
TooLarge
M_TOO_LARGE
The request or entity was too large.
UnableToAuthorizeJoin
M_UNABLE_TO_AUTHORISE_JOIN
The room is restricted and none of the conditions can be validated by the homeserver. This can happen if the homeserver does not know about any of the rooms listed as conditions, for example.
UnableToGrantJoin
M_UNABLE_TO_GRANT_JOIN
A different server should be attempted for the join. This is typically because the resident server can see that the joining user satisfies one or more conditions, such as in the case of restricted rooms, but the resident server would be unable to meet the authorization rules.
M_UNAUTHORIZED
The request was not correctly authorized. Usually due to login failures.
Unknown
M_UNKNOWN
An unknown error has occurred.
UnknownPos
unstable-msc3575
or unstable-msc4186
only.UnknownToken
M_UNKNOWN_TOKEN
The access or refresh token specified was not recognized.
Fields
soft_logout: bool
If this is true
, the client is in a “soft logout” state, i.e. the server requires
re-authentication but the session is not invalidated. The client can acquire a new
access token by specifying the device ID it is already using to the login API.
Unrecognized
M_UNRECOGNIZED
The server did not understand the request.
This is expected to be returned with a 404 HTTP status code if the endpoint is not implemented or a 405 HTTP status code if the endpoint is implemented, but the incorrect HTTP method is used.
UnsupportedRoomVersion
M_UNSUPPORTED_ROOM_VERSION
The request to create_room
used a room version that the server does not support.
UrlNotSet
M_URL_NOT_SET
The application service doesn’t have a URL configured.
UserDeactivated
M_USER_DEACTIVATED
The user ID associated with the request has been deactivated.
UserInUse
M_USER_IN_USE
The desired user ID is already taken.
UserLocked
M_USER_LOCKED
The account has been locked and cannot be used at this time.
UserSuspended
M_USER_SUSPENDED
The account has been suspended and can only be used for limited actions at this time.
WeakPassword
M_WEAK_PASSWORD
The password was rejected by the server for being too weak.
WrongRoomKeysVersion
M_WRONG_ROOM_KEYS_VERSION
The version of the room keys backup provided in the request does not match the current backup version.
Implementations§
§impl ErrorKind
impl ErrorKind
pub fn forbidden() -> ErrorKind
pub fn forbidden() -> ErrorKind
Constructs an empty ErrorKind::Forbidden
variant.
pub fn forbidden_with_authenticate(authenticate: AuthenticateError) -> ErrorKind
Available on crate feature unstable-msc2967
only.
pub fn forbidden_with_authenticate(authenticate: AuthenticateError) -> ErrorKind
unstable-msc2967
only.Constructs an ErrorKind::Forbidden
variant with the given WWW-Authenticate
header
error message.
Trait Implementations§
§impl<'de> Deserialize<'de> for ErrorKind
impl<'de> Deserialize<'de> for ErrorKind
§fn deserialize<D>(
deserializer: D,
) -> Result<ErrorKind, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ErrorKind, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Serialize for ErrorKind
impl Serialize for ErrorKind
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl Eq for ErrorKind
impl StructuralPartialEq for ErrorKind
Auto Trait Implementations§
impl Freeze for ErrorKind
impl RefUnwindSafe for ErrorKind
impl Send for ErrorKind
impl Sync for ErrorKind
impl Unpin for ErrorKind
impl UnwindSafe for ErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more