matrix_sdk::ruma::api::client::error

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>, },
}
Available on crate feature 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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

§body: Option<String>

The body 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
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§authenticate: Option<AuthenticateError>
Available on crate feature 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.

Fields

§admin_contact: String

A URI giving a contact method for the server administrator.

§

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.

§

Unauthorized

M_UNAUTHORIZED

The request was not correctly authorized. Usually due to login failures.

§

Unknown

M_UNKNOWN

An unknown error has occurred.

§

UnknownPos

Available on crate features unstable-msc3575 or unstable-msc4186 only.

M_UNKNOWN_POS

The sliding sync (MSC3575 / MSC4186) connection was expired by the server.

§

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.

Fields

§current_version: Option<String>

The currently active backup version.

Implementations§

§

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

Constructs an ErrorKind::Forbidden variant with the given WWW-Authenticate header error message.

pub fn errcode(&self) -> ErrorCode

Get the ErrorCode for this ErrorKind.

Trait Implementations§

§

impl Clone for ErrorKind

§

fn clone(&self) -> ErrorKind

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for ErrorKind

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for ErrorKind

§

fn deserialize<D>( deserializer: D, ) -> Result<ErrorKind, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl PartialEq for ErrorKind

§

fn eq(&self, other: &ErrorKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for ErrorKind

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl Eq for ErrorKind

§

impl StructuralPartialEq for ErrorKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> CompatExt for T

§

fn compat(self) -> Compat<T>

Applies the [Compat] adapter by value. Read more
§

fn compat_ref(&self) -> Compat<&T>

Applies the [Compat] adapter by shared reference. Read more
§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the [Compat] adapter by mutable reference. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<>
Source§

fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

impl<T> AsyncTraitDeps for T

Source§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneAnySend for T
where T: Any + Send + Clone,

Source§

impl<T> CloneAnySendSync for T
where T: Any + Send + Sync + Clone,

Source§

impl<T> CloneAnySync for T
where T: Any + Sync + Clone,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> SendOutsideWasm for T
where T: Send,

Source§

impl<T> SyncOutsideWasm for T
where T: Sync,