sos_server_storage/
error.rs

1use sos_core::{AccountId, VaultId};
2use std::path::PathBuf;
3use thiserror::Error;
4
5/// Errors generated by the server storage library.
6#[derive(Debug, Error)]
7pub enum Error {
8    /// Error generated when a directory is expected.
9    #[error("path '{0}' is not a directory")]
10    NotDirectory(PathBuf),
11
12    /// Error generated if we could not determine a cache directory.
13    #[error("could not determine cache directory")]
14    NoCache,
15
16    /// Error generated if we could not find a login folder for an account.
17    #[error("could not find login folder for '{0}'")]
18    NoLoginFolder(AccountId),
19
20    /// Error generated if we could not find a create vault event
21    /// in a collection of event records or as the first event in
22    /// a folder event log.
23    #[error("could not find create vault event")]
24    NoVaultEvent,
25
26    /// Error generated when vault identifiers must match.
27    #[error("identifier '{0}' does not match '{1}'")]
28    VaultIdentifierMismatch(VaultId, VaultId),
29
30    /// Errors generated by the core library.
31    #[error(transparent)]
32    Core(#[from] sos_core::Error),
33
34    /// Errors generated by the backend library.
35    #[error(transparent)]
36    Backend(#[from] sos_backend::Error),
37
38    /// Errors generated by the filesystem library.
39    #[error(transparent)]
40    FileSystem(#[from] sos_filesystem::Error),
41
42    /// Errors generated by the vault library.
43    #[error(transparent)]
44    Vault(#[from] sos_vault::Error),
45
46    /// Errors generated by the protocol library.
47    #[error(transparent)]
48    Protocol(#[from] sos_protocol::Error),
49
50    /// Errors generated by the sync library.
51    #[error(transparent)]
52    Sync(#[from] sos_sync::Error),
53
54    /// Errors generated by the backend storage.
55    #[error(transparent)]
56    BackendStorage(#[from] sos_backend::StorageError),
57
58    /// Errors generated by the database library.
59    #[error(transparent)]
60    Database(#[from] sos_database::Error),
61
62    /// Errors generated by the SQL library.
63    #[error(transparent)]
64    Sql(#[from] sos_database::async_sqlite::Error),
65
66    /// Errors generated by the IO module.
67    #[error(transparent)]
68    Io(#[from] std::io::Error),
69}