Skip to main content

bitwarden_importers/
error.rs

1use bitwarden_error::bitwarden_error;
2use thiserror::Error;
3
4#[allow(missing_docs)]
5#[bitwarden_error(flat)]
6#[derive(Error, Debug)]
7pub enum ImportError {
8    #[error("The file is not a valid KeePass database (.kdbx)")]
9    KdbxInvalidFormat,
10    #[error("The KeePass database exceeds the maximum supported size")]
11    KdbxFileTooLarge,
12    #[error("Incorrect KeePass password or key file")]
13    KdbxWrongCredentials,
14    #[error("The KeePass database could not be read; it may be corrupted or unsupported")]
15    KdbxCorruptOrUnsupported,
16
17    #[error("The 1Password email address is not valid")]
18    OnePasswordInvalidEmail,
19    #[error("The 1Password sign-in address is not valid")]
20    OnePasswordInvalidSignInAddress,
21    #[error("The 1Password Secret Key is not valid")]
22    OnePasswordInvalidSecretKey,
23    #[error("Incorrect 1Password email, password, or Secret Key")]
24    OnePasswordBadCredentials,
25    #[error("The 1Password account requires a two-factor code")]
26    OnePasswordTwoFactorRequired,
27    #[error("The 1Password two-factor code was rejected or not entered")]
28    OnePasswordTwoFactorFailed,
29    #[error("This 1Password account uses a sign-in method the importer does not support: {0}")]
30    OnePasswordUnsupported(String),
31    #[error("Could not reach 1Password: {0}")]
32    OnePasswordNetwork(String),
33    #[error("The data 1Password returned could not be read")]
34    OnePasswordDecryption,
35
36    #[error(transparent)]
37    NotAuthenticated(#[from] bitwarden_core::NotAuthenticatedError),
38    #[error(transparent)]
39    Api(#[from] bitwarden_core::ApiError),
40    #[error(transparent)]
41    BitwardenCrypto(#[from] bitwarden_crypto::CryptoError),
42    /// A Keeper importer cryptography operation failed.
43    #[error(transparent)]
44    KeeperCrypto(#[from] crate::keeper::crypto::KeeperCryptoError),
45    /// Encryption from the shared import bridge (`bitwarden_exporters::encrypt_import`).
46    #[error(transparent)]
47    Export(#[from] bitwarden_exporters::ExportError),
48}