sos_migrate/
error.rs

1//! Error type for the library.
2use thiserror::Error;
3
4/// Error type for the migration library.
5#[derive(Debug, Error)]
6pub enum Error {
7    /// Error generated from strings.
8    #[error("{0}")]
9    Message(String),
10
11    /// Error generated when an unknown import format is detected.
12    #[error(r#"import format "{0}" is not supported"#)]
13    UnknownImportFormat(String),
14
15    /// Error generated when no authenticator URLs were found.
16    #[error("no authenticator URLs found in zip archive '{0}'")]
17    NoAuthenticatorUrls(String),
18
19    /// Error generated by the io module.
20    #[error(transparent)]
21    Io(#[from] std::io::Error),
22
23    /// Error generated by the vault library.
24    #[error(transparent)]
25    Core(#[from] sos_core::Error),
26
27    /// Error generated by the backend library.
28    #[error(transparent)]
29    Backend(#[from] sos_backend::Error),
30
31    /// Error generated by the vault library.
32    #[error(transparent)]
33    Vault(#[from] sos_vault::Error),
34
35    /// Error generated by the CSV library.
36    #[error(transparent)]
37    Csv(#[from] csv_async::Error),
38
39    /// Error generated by the ZIP library.
40    #[error(transparent)]
41    Zip(#[from] async_zip::error::ZipError),
42
43    /// Error generated by the JSON library.
44    #[error(transparent)]
45    Json(#[from] serde_json::Error),
46
47    /// Error generated by the URL library.
48    #[error(transparent)]
49    Url(#[from] url::ParseError),
50
51    /// Error generated by the TOTP library.
52    #[error(transparent)]
53    TotpUrl(#[from] totp_rs::TotpUrlError),
54
55    #[cfg(all(
56        target_os = "macos",
57        feature = "import",
58        feature = "keychain-access"
59    ))]
60    /// Error generated by the keychain import library.
61    #[error(transparent)]
62    Keychain(#[from] crate::import::keychain::Error),
63
64    #[cfg(all(
65        target_os = "macos",
66        feature = "import",
67        feature = "keychain-access"
68    ))]
69    /// Error generated by the keychain parser library.
70    #[error(transparent)]
71    KeychainParser(#[from] keychain_parser::Error),
72}