git_crypt/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum GitCryptError {
5    #[error("Git error: {0}")]
6    Git(#[from] git2::Error),
7
8    #[error("I/O error: {0}")]
9    Io(#[from] std::io::Error),
10
11    #[error("Cryptography error: {0}")]
12    Crypto(String),
13
14    #[error("GPG error: {0}")]
15    Gpg(String),
16
17    #[cfg(feature = "ssh")]
18    #[error("age/rage error: {0}")]
19    Age(String),
20
21    #[error("Repository not initialized. Run 'git-crypt init' first")]
22    NotInitialized,
23
24    #[error("Repository already initialized")]
25    AlreadyInitialized,
26
27    #[error("Key not found: {0}")]
28    KeyNotFound(String),
29
30    #[error("Invalid key format")]
31    InvalidKeyFormat,
32
33    #[error("Not in a git repository")]
34    NotInGitRepo,
35
36    #[error("{0}")]
37    Other(String),
38}
39
40pub type Result<T> = std::result::Result<T, GitCryptError>;