wacore_appstate/
errors.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum AppStateError {
5 #[error("missing value MAC of previous SET operation")]
6 MissingPreviousSetValueOperation,
7 #[error("mismatching LTHash")]
8 MismatchingLTHash,
9 #[error("mismatching patch MAC")]
10 MismatchingPatchMAC,
11 #[error("mismatching content MAC")]
12 MismatchingContentMAC,
13 #[error("mismatching index MAC")]
14 MismatchingIndexMAC,
15 #[error("didn't find app state key")]
16 KeyNotFound,
17 #[error("missing value blob in record")]
18 MissingValueBlob,
19 #[error("value blob too short (need at least 48 bytes for IV + MAC)")]
20 ValueBlobTooShort,
21 #[error("decryption failed")]
22 DecryptionFailed,
23 #[error("failed to decode protobuf")]
24 DecodeFailed,
25 #[error("missing index MAC in record")]
26 MissingIndexMAC,
27 #[error("missing key ID in record")]
28 MissingKeyId,
29 #[error("snapshot MAC mismatch")]
30 SnapshotMACMismatch,
31 #[error("patch snapshot MAC mismatch")]
32 PatchSnapshotMACMismatch,
33 #[error("patch MAC mismatch")]
34 PatchMACMismatch,
35 #[error("patch version mismatch: expected {expected}, got {got}")]
36 PatchVersionMismatch { expected: u64, got: u64 },
37}
38
39pub type Result<T> = std::result::Result<T, AppStateError>;