1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum FossilError {
5 #[error("Database error: {0}")]
6 Database(#[from] rusqlite::Error),
7
8 #[error("IO error: {0}")]
9 Io(#[from] std::io::Error),
10
11 #[error("Artifact not found: {0}")]
12 ArtifactNotFound(String),
13
14 #[error("Invalid artifact format: {0}")]
15 InvalidArtifact(String),
16
17 #[error("Decompression failed: {0}")]
18 Decompression(String),
19
20 #[error("Delta application failed: {0}")]
21 DeltaFailed(String),
22
23 #[error("Hash mismatch: expected {expected}, got {actual}")]
24 HashMismatch { expected: String, actual: String },
25
26 #[error("Not a heroforge repository")]
27 NotARepository,
28
29 #[error("Ambiguous hash prefix: {0}")]
30 AmbiguousHash(String),
31
32 #[error("Sync error: {0}")]
33 SyncError(String),
34}
35
36pub type Result<T> = std::result::Result<T, FossilError>;