pacman_key/
error.rs

1use std::io;
2
3#[derive(Debug, thiserror::Error)]
4#[non_exhaustive]
5pub enum Error {
6    #[error("command execution failed: {0}")]
7    Command(#[from] io::Error),
8
9    #[error("pacman-key exited with status {status}: {stderr}")]
10    PacmanKey { status: i32, stderr: String },
11
12    #[error("invalid key ID '{keyid}': {reason}")]
13    InvalidKeyId { keyid: String, reason: String },
14
15    #[error("invalid keyring name '{name}': {reason}")]
16    InvalidKeyringName { name: String, reason: String },
17
18    #[error("key not found: {0}")]
19    KeyNotFound(String),
20
21    #[error("keyring not initialized")]
22    KeyringNotInitialized,
23
24    #[error("permission denied (requires root)")]
25    PermissionDenied,
26
27    #[error("operation timed out after {0} seconds")]
28    Timeout(u64),
29
30    #[error("failed to capture stderr from subprocess")]
31    StderrCaptureFailed,
32}
33
34pub type Result<T> = std::result::Result<T, Error>;