Skip to main content

MessengerError

Enum MessengerError 

Source
pub enum MessengerError {
    InvalidId {
        kind: &'static str,
        value: String,
        reason: String,
    },
    WireDecode(Error),
    Http {
        status: u16,
        errcode: String,
        error: String,
    },
    Crypto(String),
    Store(StoreError),
    FlushPending,
    EditNotOwned {
        event_id: EventId,
    },
    IntentRefused(String),
}
Expand description

Every error this crate’s public API can return. Sans-I/O by construction (see the crate doc): this type never itself performs I/O — it only describes a failure the caller (a shell, or another module in this crate) already observed.

Variants§

§

InvalidId

One of the identifier newtypes in crate::ids rejected a value.

Fields

§kind: &'static str

The newtype that rejected the value ("UserId", "RoomId", …).

§value: String

The rejected input, verbatim.

§reason: String

Why it was rejected.

§

WireDecode(Error)

A wire payload (an HTTP response body, a /sync response, …) was not valid JSON, or did not match the shape this crate expected of it.

§

Http

An HTTP response came back with an error status and a Matrix-shaped {"errcode": ..., "error": ...} body (client-server API’s own standard error response shape).

Fields

§status: u16

The HTTP status code.

§errcode: String

The Matrix errcode (e.g. "M_FORBIDDEN").

§error: String

The Matrix error human-readable string.

§

Crypto(String)

A cryptographic operation (Olm/Megolm/SAS via mail4agent_vodozemac, or the local record seal) failed. Wrapped as a plain message rather than the concrete upstream error type: this crate’s own public API must not leak mail4agent_vodozemac’s error enum shape as part of its own contract.

§

Store(StoreError)

§

FlushPending

Raised when a caller (crate::outgoing_queue/a later sync_engine piece) attempts to release an outgoing request while crate::persist::FlushEpoch::is_released reports it is not yet safe to do so — a state mutation the request depends on is not yet durably flushed and acknowledged. See the persist module doc for the exact per-request ordering guarantee this enforces.

§

EditNotOwned

crate::MessengerCommand::SendMessage named an edit_of target this account did not itself send (or that this core has never seen at all) — rejected outright by crate::MessengerCore::dispatch rather than silently sent as a replacement every other member’s own m.replace aggregation would ignore anyway (crate::room::relations’s own module doc: “must come from the original sender”).

Fields

§event_id: EventId

The event the caller tried to edit.

§

IntentRefused(String)

A crate::MessengerCommand the core refused to apply. The message names the command and the reason (an unknown room, a sealed event, …).

Trait Implementations§

Source§

impl Debug for MessengerError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for MessengerError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Error for MessengerError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<CanonicalJsonError> for MessengerError

Source§

fn from(err: CanonicalJsonError) -> Self

crate::canonical_json is its own small, dependency-light module (it only needs mail4agent_vodozemac’s signature types, not this crate’s error type) – this conversion is what lets crypto::account and later pieces use ? against it without that module needing to know about MessengerError itself.

Source§

impl From<Error> for MessengerError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<MessengerError> for OlmDecryptError

Source§

fn from(source: MessengerError) -> Self

Converts to this type from the input type.
Source§

impl From<StoreError> for MessengerError

Source§

fn from(source: StoreError) -> Self

Converts to this type from the input type.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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