openmls/test_utils/test_framework/
errors.rs

1use thiserror::Error;
2
3use crate::{error::LibraryError, group::errors::*};
4use openmls_rust_crypto::MemoryStorage;
5
6/// Setup error
7#[derive(Error, Debug, PartialEq)]
8pub enum SetupError<StorageError> {
9    #[error("")]
10    UnknownGroupId,
11    #[error("")]
12    UnknownClientId,
13    #[error("")]
14    NotEnoughClients,
15    #[error("")]
16    ClientAlreadyInGroup,
17    #[error("")]
18    ClientNotInGroup,
19    #[error("")]
20    NoFreshKeyPackage,
21    /// See [`ClientError`] for more details.
22    #[error(transparent)]
23    ClientError(#[from] ClientError<StorageError>),
24    /// See [`ExportSecretError`] for more details.
25    #[error(transparent)]
26    ExportSecretError(#[from] ExportSecretError),
27    /// See [`LibraryError`] for more details.
28    #[error(transparent)]
29    LibraryError(#[from] LibraryError),
30    #[error("")]
31    Unknown,
32}
33
34#[derive(Debug)]
35pub enum SetupGroupError {
36    NotEnoughMembers,
37}
38
39/// Errors that can occur when processing messages with the client.
40#[derive(Error, Debug, PartialEq)]
41pub enum ClientError<StorageError> {
42    #[error("")]
43    NoMatchingKeyPackage,
44    #[error("")]
45    NoMatchingCredential,
46    #[error("")]
47    CiphersuiteNotSupported,
48    #[error("")]
49    NoMatchingGroup,
50    #[error("")]
51    NoCiphersuite,
52    /// See [`WelcomeError`] for more details.
53    #[error(transparent)]
54    FailedToJoinGroup(#[from] WelcomeError<StorageError>),
55    /// See [`tls_codec::Error`] for more details.
56    #[error(transparent)]
57    TlsCodecError(tls_codec::Error),
58    /// See [`ProcessMessageError`] for more details.
59    #[error("See ProcessMessageError for more details.")]
60    ProcessMessageError(ProcessMessageError<StorageError>),
61    /// See [`AddMembersError`] for more details.
62    #[error(transparent)]
63    AddMembersError(#[from] AddMembersError<StorageError>),
64    /// See [`RemoveMembersError`] for more details.
65    #[error(transparent)]
66    RemoveMembersError(#[from] RemoveMembersError<StorageError>),
67    /// See [`ProposeAddMemberError`] for more details.
68    #[error(transparent)]
69    ProposeAddMemberError(#[from] ProposeAddMemberError<StorageError>),
70    /// See [`ProposeRemoveMemberError`] for more details.
71    #[error(transparent)]
72    ProposeRemoveMemberError(#[from] ProposeRemoveMemberError<StorageError>),
73    /// See [`ExportSecretError`] for more details.
74    #[error("Error exporting secret")]
75    ExportSecretError(ExportSecretError),
76    /// See [`NewGroupError`] for more details.
77    #[error(transparent)]
78    NewGroupError(#[from] NewGroupError<StorageError>),
79    /// See [`SelfUpdateError`] for more details.
80    #[error(transparent)]
81    SelfUpdateError(#[from] SelfUpdateError<StorageError>),
82    /// See [`ProposeSelfUpdateError`] for more details.
83    #[error(transparent)]
84    ProposeSelfUpdateError(#[from] ProposeSelfUpdateError<StorageError>),
85    /// See [`MergePendingCommitError`] for more details.
86    #[error(transparent)]
87    MergePendingCommitError(#[from] MergePendingCommitError<StorageError>),
88    /// See [`MergeCommitError`] for more details.
89    #[error(transparent)]
90    MergeCommitError(#[from] MergeCommitError<StorageError>),
91    /// See `StorageError` for more details.
92    #[error(transparent)]
93    KeyStoreError(#[from] StorageError),
94    /// See [`LibraryError`] for more details.
95    #[error(transparent)]
96    LibraryError(LibraryError),
97    #[error("")]
98    Unknown,
99}