sos_integrity/
error.rs

1use sos_core::commit::CommitHash;
2use thiserror::Error;
3use uuid::Uuid;
4
5/// Errors generated by the integrity library.
6#[derive(Debug, Error)]
7pub enum Error {
8    /// Error generated when event log row data does
9    /// not match the commit hash.
10    #[error("row '{id}' checksums do not match, expected {commit} but got {value}")]
11    VaultHashMismatch {
12        /// Expected commit hash.
13        commit: CommitHash,
14        /// Commit hash of the value.
15        value: CommitHash,
16        /// Record identifier.
17        id: Uuid,
18    },
19
20    /// Error generated when event log row data does
21    /// not match the commit hash.
22    #[error("row checksums do not match, expected {commit} but got {value}")]
23    HashMismatch {
24        /// Expected commit hash.
25        commit: CommitHash,
26        /// Commit hash of the value.
27        value: CommitHash,
28    },
29
30    /// Error generated converting to fixed length slice.
31    #[error(transparent)]
32    TryFromSlice(#[from] std::array::TryFromSliceError),
33
34    /// Error generated by the core library.
35    #[error(transparent)]
36    Core(#[from] sos_core::Error),
37
38    /// Error generated by the backend library.
39    #[error(transparent)]
40    Backend(#[from] sos_backend::Error),
41
42    /// Error generated by the vault library.
43    #[error(transparent)]
44    Vault(#[from] sos_vault::Error),
45
46    /// Error generated by the filesystem library.
47    #[error(transparent)]
48    FileSystem(#[from] sos_filesystem::Error),
49
50    /// Error generated by the database library.
51    #[error(transparent)]
52    Database(#[from] sos_database::Error),
53
54    /// Error generated by the sqlite library.
55    #[error(transparent)]
56    AsyncSqlite(#[from] sos_database::async_sqlite::Error),
57
58    /// Error generated by the sqlite library.
59    #[error(transparent)]
60    Sqlite(#[from] sos_database::async_sqlite::rusqlite::Error),
61
62    /// Error generated by the IO module.
63    #[error(transparent)]
64    Io(#[from] std::io::Error),
65
66    /// Error generated parsing UUIDs.
67    #[error(transparent)]
68    Uuid(#[from] uuid::Error),
69
70    /// Error generated when attempting to join a task.
71    #[error(transparent)]
72    Join(#[from] tokio::task::JoinError),
73}