bitwarden_uniffi/
error.rs1use bitwarden_exporters::ExportError;
2use bitwarden_generators::{PassphraseError, PasswordError, PasswordRulesError, UsernameError};
3
4pub type Result<T, E = BitwardenError> = std::result::Result<T, E>;
5pub type Error = BitwardenError;
6
7#[derive(uniffi::Error, thiserror::Error, Debug)]
14pub enum BitwardenError {
15 #[error(transparent)]
16 Api(#[from] bitwarden_core::ApiError),
17 #[error(transparent)]
18 DeriveKeyConnector(#[from] bitwarden_core::key_management::crypto::DeriveKeyConnectorError),
19 #[error(transparent)]
20 EncryptionSettings(
21 #[from] bitwarden_core::client::encryption_settings::EncryptionSettingsError,
22 ),
23 #[error(transparent)]
24 EnrollAdminPasswordReset(
25 #[from] bitwarden_core::key_management::crypto::EnrollAdminPasswordResetError,
26 ),
27 #[error(transparent)]
28 MobileCrypto(#[from] bitwarden_core::key_management::crypto::CryptoClientError),
29 #[error(transparent)]
30 ReinitUserCrypto(#[from] bitwarden_core::key_management::crypto::ReinitUserCryptoError),
31 #[error(transparent)]
32 AuthValidate(#[from] bitwarden_core::auth::AuthValidateError),
33 #[error(transparent)]
34 ApproveAuthRequest(#[from] bitwarden_core::auth::ApproveAuthRequestError),
35 #[error(transparent)]
36 TrustDevice(#[from] bitwarden_core::auth::auth_client::TrustDeviceError),
37 #[error(transparent)]
38 Registration(#[from] bitwarden_auth::registration::RegistrationError),
39 #[error(transparent)]
40 PasswordPrelogin(#[from] bitwarden_auth::login::login_via_password::PasswordPreloginError),
41 #[error(transparent)]
42 PasswordLogin(#[from] bitwarden_auth::login::login_via_password::PasswordLoginError),
43
44 #[error(transparent)]
45 Fingerprint(#[from] bitwarden_core::platform::FingerprintError),
46 #[error(transparent)]
47 UserFingerprint(#[from] bitwarden_core::platform::UserFingerprintError),
48
49 #[error(transparent)]
50 Crypto(#[from] bitwarden_crypto::CryptoError),
51
52 #[error(transparent)]
53 StateRegistry(#[from] bitwarden_state::registry::StateRegistryError),
54
55 #[error(transparent)]
57 Username(#[from] UsernameError),
58 #[error(transparent)]
59 Passphrase(#[from] PassphraseError),
60 #[error(transparent)]
61 Password(#[from] PasswordError),
62 #[error(transparent)]
63 PasswordRules(#[from] PasswordRulesError),
64
65 #[error(transparent)]
67 Cipher(#[from] bitwarden_vault::CipherError),
68 #[error(transparent)]
69 Totp(#[from] bitwarden_vault::TotpError),
70 #[error(transparent)]
71 Decrypt(#[from] bitwarden_vault::DecryptError),
72 #[error(transparent)]
73 DecryptFile(#[from] bitwarden_vault::DecryptFileError),
74 #[error(transparent)]
75 Encrypt(#[from] bitwarden_vault::EncryptError),
76 #[error(transparent)]
77 EncryptFile(#[from] bitwarden_vault::EncryptFileError),
78 #[error(transparent)]
79 CreateCipher(#[from] bitwarden_vault::CreateCipherError),
80 #[error(transparent)]
81 EditCipher(#[from] bitwarden_vault::EditCipherError),
82 #[error(transparent)]
83 DeleteCipher(#[from] bitwarden_vault::DeleteCipherError),
84 #[error(transparent)]
85 GetCipher(#[from] bitwarden_vault::GetCipherError),
86 #[error(transparent)]
87 RestoreCipher(#[from] bitwarden_vault::RestoreCipherError),
88 #[error(transparent)]
89 MoveCipher(#[from] bitwarden_vault::MoveCipherError),
90 #[error(transparent)]
91 BulkUpdateCollectionsCipher(#[from] bitwarden_vault::BulkUpdateCollectionsCipherError),
92 #[error(transparent)]
93 CreateFolder(#[from] bitwarden_vault::CreateFolderError),
94 #[error(transparent)]
95 EditFolder(#[from] bitwarden_vault::EditFolderError),
96 #[error(transparent)]
97 GetFolder(#[from] bitwarden_vault::GetFolderError),
98 #[error(transparent)]
99 CreateAttachment(#[from] bitwarden_vault::CipherCreateAttachmentError),
100 #[error(transparent)]
101 DeleteAttachment(#[from] bitwarden_vault::CipherDeleteAttachmentError),
102 #[error(transparent)]
103 RenewFileUploadUrl(#[from] bitwarden_vault::CipherRenewFileUploadUrlError),
104 #[error(transparent)]
105 UpgradeAttachment(#[from] bitwarden_vault::CipherUpgradeAttachmentError),
106 #[error(transparent)]
107 GetAttachmentDownloadUrl(#[from] bitwarden_vault::CipherGetAttachmentDownloadUrlError),
108
109 #[error(transparent)]
111 CollectionDecrypt(#[from] bitwarden_collections::error::CollectionDecryptError),
112 #[error(transparent)]
113 CollectionEncrypt(#[from] bitwarden_collections::error::CollectionEncryptError),
114
115 #[error(transparent)]
117 SendDecrypt(#[from] bitwarden_send::SendDecryptError),
118 #[error(transparent)]
119 SendDecryptFile(#[from] bitwarden_send::SendDecryptFileError),
120 #[error(transparent)]
121 SendEncrypt(#[from] bitwarden_send::SendEncryptError),
122 #[error(transparent)]
123 SendEncryptFile(#[from] bitwarden_send::SendEncryptFileError),
124
125 #[error(transparent)]
126 Export(#[from] ExportError),
127 #[error(transparent)]
128 Import(#[from] bitwarden_importers::ImportError),
129
130 #[error(transparent)]
132 MakeCredential(#[from] bitwarden_fido::MakeCredentialError),
133 #[error(transparent)]
134 GetAssertion(#[from] bitwarden_fido::GetAssertionError),
135 #[error(transparent)]
136 SilentlyDiscoverCredentials(#[from] bitwarden_fido::SilentlyDiscoverCredentialsError),
137 #[error(transparent)]
138 CredentialsForAutofill(#[from] bitwarden_fido::CredentialsForAutofillError),
139 #[error(transparent)]
140 GetFido2AutofillCredentials(#[from] bitwarden_fido::GetFido2AutofillCredentialsError),
141 #[error(transparent)]
142 Fido2Client(#[from] bitwarden_fido::Fido2ClientError),
143 #[error(transparent)]
144 DeviceAuthKey(#[from] bitwarden_fido::DeviceAuthKeyError),
145
146 #[error(transparent)]
147 SshGeneration(#[from] bitwarden_ssh::error::KeyGenerationError),
148 #[error(transparent)]
149 SshImport(#[from] bitwarden_ssh::error::SshKeyImportError),
150
151 #[error(transparent)]
152 AcquireCookie(#[from] bitwarden_server_communication_config::AcquireCookieError),
153
154 #[error("Callback invocation failed")]
155 Callback,
156
157 #[error("A conversion error occurred: {0}")]
158 Conversion(String),
159}
160impl From<uniffi::UnexpectedUniFFICallbackError> for BitwardenError {
163 fn from(_: uniffi::UnexpectedUniFFICallbackError) -> Self {
164 Self::Callback
165 }
166}