Skip to main content

libgrite_git/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur during Git operations
4#[derive(Debug, Error)]
5pub enum GitError {
6    #[error("Git error: {0}")]
7    Git(#[from] git2::Error),
8
9    #[error("IO error: {0}")]
10    Io(#[from] std::io::Error),
11
12    #[error("JSON error: {0}")]
13    Json(#[from] serde_json::Error),
14
15    #[error("CBOR decode error: {0}")]
16    CborDecode(String),
17
18    #[error("Invalid chunk format: {0}")]
19    InvalidChunk(String),
20
21    #[error("WAL error: {0}")]
22    Wal(String),
23
24    #[error("Snapshot error: {0}")]
25    Snapshot(String),
26
27    #[error("Sync error: {0}")]
28    Sync(String),
29
30    #[error("Invalid event data: {0}")]
31    InvalidEvent(String),
32
33    #[error("Not a git repository")]
34    NotARepo,
35
36    #[error("Parse error: {0}")]
37    ParseError(String),
38
39    #[error("Lock conflict: {resource} is locked by {owner} (expires in {expires_in_ms}ms)")]
40    LockConflict {
41        resource: String,
42        owner: String,
43        expires_in_ms: u64,
44    },
45
46    #[error("Lock not owned: {resource} is owned by {owner}")]
47    LockNotOwned {
48        resource: String,
49        owner: String,
50    },
51}