core_crypto/mls/conversation/
error.rs1#![allow(missing_docs)]
5
6use super::config::MAX_PAST_EPOCHS;
7use crate::ClientId;
8
9pub type Result<T, E = Error> = core::result::Result<T, E>;
10
11#[derive(Debug, thiserror::Error)]
12pub enum Error {
13 #[error("Message body type not suitable for restoration")]
14 InappropriateMessageBodyType,
15 #[error("Member with id {_0} doesn't exist")]
16 MemberNotFound(ClientId),
17 #[error(
18 "The tnt message counter has overflowed. You sent 2^32 targeted or transient messages in this epoch. Increment
19 the epoch and try again."
20 )]
21 TntMessageCounterOverflow,
22 #[error("Message rejected by the delivery service. Reason: {reason}")]
24 MessageRejected {
25 reason: String,
27 },
28 #[error("We already decrypted this message once")]
29 DuplicateMessage,
30 #[error("The epoch in which message was encrypted is older than {MAX_PAST_EPOCHS}")]
31 MessageEpochTooOld,
32 #[error("Incoming message is from a prior epoch")]
33 StaleMessage,
34 #[error(
35 "Incoming message is a commit for which we have not yet received all the proposals. Buffering until all proposals have arrived."
36 )]
37 BufferedCommit,
38 #[error("Incoming message is for a future epoch. We will buffer it until the commit for that epoch arrives")]
39 BufferedFutureMessage { message_epoch: u64 },
40 #[error(
41 "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"
42 )]
43 BufferedForPendingConversation,
44 #[error("Incoming message is from an epoch too far in the future to buffer.")]
45 UnbufferedFarFutureMessage,
46 #[error("The received commit is deemed stale and is from an older epoch.")]
47 StaleCommit,
48 #[error("The received proposal is deemed stale and is from an older epoch.")]
49 StaleProposal,
50 #[error("An application message failed to decrypt")]
51 DecryptionError,
52 #[error("MLS Client was not initialized the right way")]
53 IdentityInitializationError,
54 #[error("MLS group is in an invalid state: {0}")]
55 MlsGroupInvalidState(&'static str),
56 #[error("MLS message is in an invalid state: {0}")]
57 MlsMessageInvalidState(&'static str),
58 #[error("The group lacks an ExternalSender extension whereas it should have at least one")]
59 MissingExternalSenderExtension,
60 #[error("unexpectedly failed to retrieve group info")]
61 MissingGroupInfo,
62 #[error("Couldn't find pending commit")]
63 PendingCommitNotFound,
64 #[error("Couldn't find pending conversation")]
65 PendingConversationNotFound,
66 #[error(
67 "Happens when a client creates a commit, sends it to the DS which accepts it but then client \
68 clears this pending commit and creates another commit. This is triggered when the client tries to decrypt the original commit.\
69 This means something is very wrong in the client's code and has to be fixed immediately"
70 )]
71 ClearingPendingCommitError,
72 #[error("Tried to decrypt a commit created by self which is likely to have been replayed by the DS")]
73 SelfCommitIgnored,
74 #[error("caller error: {0}")]
75 CallerError(&'static str),
76 #[error(
81 "Although this Welcome seems valid, the local KeyPackage it references has already been deleted locally. Join this group with an external commit"
82 )]
83 OrphanWelcome,
84 #[error("Operation couldn't be performed due to duplicate signature for clients: {affected_clients:?}")]
85 DuplicateSignature {
86 affected_clients: Vec<(crate::ClientId, crate::ClientId)>,
87 },
88 #[error(transparent)]
89 Tls(#[from] crate::TlsCodecError),
90 #[error(transparent)]
91 OpenMls(#[from] crate::OpenMlsError),
92 #[error(transparent)]
93 Keystore(#[from] crate::KeystoreError),
94 #[error(transparent)]
95 Recursive(#[from] crate::RecursiveError),
96}