sos_backend/
error.rs

1#[cfg(feature = "archive")]
2use std::path::PathBuf;
3use thiserror::Error;
4
5/// Errors generated by the library.
6#[derive(Debug, Error)]
7pub enum Error {
8    /// Error generated when attempting to append audit
9    /// events without any providers configured.
10    #[error("no audit trail providers configured")]
11    AuditProvidersNotConfigured,
12
13    /// Errors generated when a backup archive ZIP does
14    /// not contain a valid manifest.
15    #[cfg(feature = "archive")]
16    #[error("not a valid backup archive '{0}' (no manifest)")]
17    NotValidBackupArchive(PathBuf),
18
19    /// Errors generated when a v1 or v2 backup archive
20    /// is used with the v3 backend.
21    #[cfg(feature = "archive")]
22    #[error("backup archive '{0}' (version {1}) is not compatible with {2} backend (backup archive needs upgrading)")]
23    BackupArchiveUpgradeRequired(PathBuf, u8, String),
24
25    /// Errors generated when a v3 backup archive is used with
26    /// the file system backend.
27    #[cfg(feature = "archive")]
28    #[error("backup archive '{0}' (version {1}) is not compatible with {2} backend (accounts need upgrading)")]
29    IncompatibleBackupArchive(PathBuf, u8, String),
30
31    /// Error generated converting to fixed length slice.
32    #[error(transparent)]
33    TryFromSlice(#[from] std::array::TryFromSliceError),
34
35    /// Errors generated by the core library.
36    #[error(transparent)]
37    Core(#[from] sos_core::Error),
38
39    /// Errors generated by the database library.
40    #[error(transparent)]
41    Database(#[from] sos_database::Error),
42
43    /// Errors generated by the filesystem library.
44    #[error(transparent)]
45    FileSystem(#[from] sos_filesystem::Error),
46
47    /// Errors generated by the ZIP archive library.
48    #[cfg(feature = "archive")]
49    #[error(transparent)]
50    ZipArchive(#[from] sos_archive::Error),
51
52    /// Errors generated by the database archive library.
53    #[cfg(feature = "archive")]
54    #[error(transparent)]
55    DatabaseArchive(#[from] sos_database::archive::Error),
56
57    /// Errors generated by the filesystem archive library.
58    #[cfg(feature = "archive")]
59    #[error(transparent)]
60    FileSystemArchive(#[from] sos_filesystem::archive::Error),
61
62    /// Errors generated by the vault library.
63    #[error(transparent)]
64    Vault(#[from] sos_vault::Error),
65
66    /// Errors generated by the IO module.
67    #[error(transparent)]
68    Io(#[from] std::io::Error),
69
70    #[cfg(feature = "preferences")]
71    /// Errors generated by the preferences library.
72    #[error(transparent)]
73    Preferences(#[from] sos_preferences::Error),
74
75    #[cfg(feature = "system-messages")]
76    /// Errors generated by the system messages library.
77    #[error(transparent)]
78    SystemMessages(#[from] sos_system_messages::Error),
79}
80
81// Backwards compatible
82pub use sos_core::StorageError;