Skip to main content

agent_vault/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum VaultError {
5    #[error("vault already initialized in {0}")]
6    AlreadyInitialized(String),
7
8    #[error("vault not found — run `agent-vault init` first")]
9    NotInitialized,
10
11    #[error("agent '{0}' already exists")]
12    AgentExists(String),
13
14    #[error("agent '{0}' not found")]
15    AgentNotFound(String),
16
17    #[error("secret '{0}' not found")]
18    SecretNotFound(String),
19
20    #[error("group '{0}' not found in manifest")]
21    GroupNotFound(String),
22
23    #[error("no identity key found — use --key or set AGENT_VAULT_KEY")]
24    NoIdentityKey,
25
26    #[error(transparent)]
27    Io(#[from] std::io::Error),
28
29    #[error("yaml error: {0}")]
30    Yaml(#[from] serde_yaml::Error),
31
32    #[error("git error: {0}")]
33    Git(#[from] git2::Error),
34
35    #[error("age encryption error: {0}")]
36    AgeEncrypt(String),
37
38    #[error("age decryption error: {0}")]
39    AgeDecrypt(String),
40
41    #[error("age key error: {0}")]
42    AgeKey(String),
43}