1use sos_core::commit::CommitHash;
2use std::path::PathBuf;
3use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum Error {
8 #[error("bad identity byte {0:#04x} at position {1} expecting {2}")]
10 BadIdentity(u8, usize, String),
11
12 #[error("buffer passed for identity check is too short")]
15 IdentityLength,
16
17 #[error("commit '{0}' could not be found")]
19 CommitNotFound(CommitHash),
20
21 #[error("checkpoint verification failed, expected root hash '{checkpoint}' but computed '{computed}', snapshot rollback completed: '{rollback_completed}' (snapshot: '{snapshot:?}')")]
25 CheckpointVerification {
26 checkpoint: CommitHash,
28 computed: CommitHash,
30 snapshot: Option<PathBuf>,
32 rollback_completed: bool,
34 },
35
36 #[error("rewind failed as pruned commits is greater than the length of the in-memory tree")]
38 RewindLeavesLength,
39
40 #[error(transparent)]
42 Core(#[from] sos_core::Error),
43
44 #[error(transparent)]
46 Vault(#[from] sos_vault::Error),
47
48 #[error(transparent)]
50 TryFromSlice(#[from] std::array::TryFromSliceError),
51
52 #[error(transparent)]
54 Io(#[from] std::io::Error),
55
56 #[error(transparent)]
58 Json(#[from] serde_json::Error),
59}