core_crypto/error/
leaf.rs

1// Wire
2// Copyright (C) 2022 Wire Swiss GmbH
3
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see http://www.gnu.org/licenses/.
16
17/// These errors can be raised from several different modules, so we centralize the definitions here
18/// to ease error-handling.
19#[derive(Debug, thiserror::Error)]
20pub enum LeafError {
21    /// This error is emitted when the requested conversation already exists with the given if
22    #[error("Conversation already exists")]
23    ConversationAlreadyExists(crate::prelude::ConversationId),
24    /// This error is emitted when the requested conversation couldn't be found in our store
25    #[error("Couldn't find conversation")]
26    ConversationNotFound(crate::prelude::ConversationId),
27    /// When looking for a X509 credential for a given ciphersuite and it has not been done
28    #[error("End-to-end identity enrollment has not been done")]
29    E2eiEnrollmentNotDone,
30    /// The MLS group is in an invalid state for an unknown reason
31    #[error("The MLS group is in an invalid state for an unknown reason")]
32    InternalMlsError,
33    /// Unexpectedly failed to retrieve group info
34    ///
35    /// This may be an implementation error.
36    #[error("unexpectedly failed to retrieve group info")]
37    MissingGroupInfo,
38}