zoe_state_machine/
error.rs

1use thiserror::Error;
2use zoe_wire_protocol::MessageFullError;
3
4use crate::state::GroupSessionError;
5
6#[cfg(feature = "frb-api")]
7use flutter_rust_bridge::frb;
8
9#[cfg_attr(feature = "frb-api", frb(opaque))]
10#[derive(Error, Debug)]
11pub enum GroupError {
12    #[error("Serialization error: {0}")]
13    Serialization(#[from] postcard::Error),
14
15    #[error("Cryptographic error: {0}")]
16    Crypto(#[from] ed25519_dalek::SignatureError),
17
18    #[error("Wire protocol error: {0}")]
19    WireProtocol(#[from] Box<dyn std::error::Error>),
20
21    #[error("Group not found: {0}")]
22    GroupNotFound(String),
23
24    #[error("Member not found in group: {member} in {group}")]
25    MemberNotFound { member: String, group: String },
26
27    #[error("Permission denied: {0}")]
28    PermissionDenied(String),
29
30    #[error("Invalid event: {0}")]
31    InvalidEvent(String),
32
33    #[error("State transition error: {0}")]
34    StateTransition(String),
35
36    #[error("Invalid group configuration: {0}")]
37    InvalidGroupConfig(String),
38
39    #[error("Crypto error: {0}")]
40    CryptoError(String),
41
42    #[error("Invalid operation: {0}")]
43    InvalidOperation(String),
44
45    #[error("Group Session error: {0}")]
46    SessionError(#[from] GroupSessionError),
47
48    #[error("Message full error: {0}")]
49    MessageFullError(#[from] MessageFullError),
50}
51
52pub type GroupResult<T> = Result<T, GroupError>;