Skip to main content

bitwarden_organization_invite_link/
error.rs

1use bitwarden_core::{ApiError, MissingFieldError};
2use bitwarden_crypto::CryptoError;
3use bitwarden_error::bitwarden_error;
4use bitwarden_organization_crypto::invite::InviteKeyBundleError;
5use thiserror::Error;
6
7/// Errors returned from invite link client operations.
8#[bitwarden_error(flat)]
9#[derive(Debug, Error)]
10pub enum InviteLinkError {
11    /// A cryptographic invite operation (creating, unsealing, or recovering the invite) failed.
12    #[error(transparent)]
13    Invite(#[from] InviteKeyBundleError),
14    /// A network request to the server failed.
15    #[error(transparent)]
16    Api(#[from] ApiError),
17    /// A low-level cryptographic operation (key wrapping, encapsulation, or public-key parsing)
18    /// failed.
19    #[error(transparent)]
20    Crypto(#[from] CryptoError),
21    /// A required field was missing from a server response.
22    #[error(transparent)]
23    MissingField(#[from] MissingFieldError),
24    /// A value was present but malformed and could not be parsed.
25    #[error("Failed to parse `{0}`")]
26    ParseFailure(&'static str),
27    /// The account-recovery public key returned by the server does not match the organization
28    /// public key bound into the invite.
29    #[error("Account recovery public key does not match the invite's bound organization key")]
30    RecoveryKeyMismatch,
31    /// No allowed domains were specified.
32    #[error("At least one allowed domain is required.")]
33    NoAllowedDomains,
34}