Skip to main content

de_mls/
error.rs

1//! Library error type: [`ConversationError`], raised by conversation operations.
2
3use std::time::SystemTimeError;
4
5use hashgraph_like_consensus::error::ConsensusError;
6
7use crate::mls_crypto::MlsError;
8
9/// Errors from operations on a single conversation — protocol faults and
10/// caller-facing guard failures alike.
11///
12/// Registry-level failures (conversation lookup, lock poisoning, transport
13/// delivery) are integrator concerns and live in the integrator's own error
14/// type — see the reference `User` in the gateway crate.
15#[derive(Debug, thiserror::Error)]
16pub enum ConversationError {
17    #[error("Cannot send message: conversation is in {0} state")]
18    ConversationBlocked(String),
19
20    #[error(
21        "Lower-priority proposal blocked: an emergency criteria proposal is active (RFC partial freeze)"
22    )]
23    PartialFreeze,
24
25    #[error("MLS error: {0}")]
26    Mls(#[from] MlsError),
27
28    #[error("Consensus error: {0}")]
29    Consensus(#[from] ConsensusError),
30
31    #[error("Message error: {0}")]
32    Message(#[from] prost::DecodeError),
33
34    #[error("System time error: {0}")]
35    SystemTime(#[from] SystemTimeError),
36
37    #[error("Caller is not a steward")]
38    NotASteward,
39
40    #[error("No proposals available")]
41    NoProposals,
42
43    #[error("Invalid conversation update request")]
44    InvalidConversationUpdateRequest,
45
46    #[error("Empty members list")]
47    EmptyMembersList,
48
49    #[error("Invalid config size")]
50    InvalidConfigSize,
51
52    #[error("Non-MLS proposals found in approved queue (ids: {proposal_ids:?})")]
53    UnexpectedNonMlsProposals { proposal_ids: Vec<u32> },
54}