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 sign-in address is not valid")]
18    OnePasswordInvalidSignInAddress,
19    #[error("Incorrect 1Password email, password, or Secret Key")]
20    OnePasswordBadCredentials,
21    #[error("The 1Password account requires a two-factor code")]
22    OnePasswordTwoFactorRequired,
23    #[error("The 1Password two-factor code was rejected or not entered")]
24    OnePasswordTwoFactorFailed,
25    #[error("This 1Password account uses a sign-in method the importer does not support: {0}")]
26    OnePasswordUnsupported(String),
27    #[error("Could not reach 1Password: {0}")]
28    OnePasswordNetwork(String),
29    #[error("The data 1Password returned could not be read")]
30    OnePasswordDecryption,
31
32    #[error(transparent)]
33    NotAuthenticated(#[from] bitwarden_core::NotAuthenticatedError),
34    #[error(transparent)]
35    Api(#[from] bitwarden_core::ApiError),
36    #[error(transparent)]
37    BitwardenCrypto(#[from] bitwarden_crypto::CryptoError),
38    /// A Keeper importer cryptography operation failed.
39    #[error(transparent)]
40    KeeperCrypto(#[from] crate::keeper::crypto::KeeperCryptoError),
41    /// Encryption from the shared import bridge (`bitwarden_exporters::encrypt_import`).
42    #[error(transparent)]
43    Export(#[from] bitwarden_exporters::ExportError),
44}