core_crypto_ffi/error/
mls.rs1use core_crypto::InnermostErrorMessage as _;
2
3#[derive(Debug, thiserror::Error)]
4#[cfg_attr(target_family = "wasm", derive(strum::AsRefStr))]
5#[cfg_attr(not(target_family = "wasm"), derive(uniffi::Error))]
6pub enum MlsError {
7 #[error("Conversation already exists")]
8 ConversationAlreadyExists(core_crypto::prelude::ConversationId),
9 #[error("We already decrypted this message once")]
10 DuplicateMessage,
11 #[error("Incoming message is for a future epoch. We will buffer it until the commit for that epoch arrives")]
12 BufferedFutureMessage,
13 #[error("Incoming message is from an epoch too far in the future to buffer.")]
14 WrongEpoch,
15 #[error(
16 "Incoming message is a commit for which we have not yet received all the proposals. Buffering until all proposals have arrived."
17 )]
18 BufferedCommit,
19 #[error("The epoch in which message was encrypted is older than allowed")]
20 MessageEpochTooOld,
21 #[error("Tried to decrypt a commit created by self which is likely to have been replayed by the DS")]
22 SelfCommitIgnored,
23 #[error(
24 "You tried to join with an external commit but did not merge it yet. We will reapply this message for you when you merge your external commit"
25 )]
26 UnmergedPendingGroup,
27 #[error("The received proposal is deemed stale and is from an older epoch.")]
28 StaleProposal,
29 #[error("The received commit is deemed stale and is from an older epoch.")]
30 StaleCommit,
31 #[error(
36 "Although this Welcome seems valid, the local KeyPackage it references has already been deleted locally. Join this group with an external commit"
37 )]
38 OrphanWelcome,
39 #[error("Message rejected by the delivery service. Reason: {reason}")]
41 MessageRejected {
42 reason: String,
44 },
45 #[error("{0}")]
46 Other(String),
47}
48
49impl From<core_crypto::MlsError> for MlsError {
50 #[inline]
51 fn from(e: core_crypto::MlsError) -> Self {
52 Self::Other(e.innermost_error_message())
53 }
54}