Skip to main content

ggen_config/receipt/
error.rs

1//! Error types for the receipt system.
2
3use thiserror::Error;
4
5/// Result type alias for receipt operations.
6pub type Result<T> = std::result::Result<T, ReceiptError>;
7
8/// Errors that can occur during receipt operations.
9#[derive(Debug, Error)]
10pub enum ReceiptError {
11    /// Signature verification failed.
12    #[error("Signature verification failed")]
13    InvalidSignature,
14
15    /// Chain verification failed.
16    #[error("Chain verification failed: {0}")]
17    InvalidChain(String),
18
19    /// Serialization error.
20    #[error("Serialization error: {0}")]
21    Serialization(#[from] serde_json::Error),
22
23    /// Invalid receipt structure.
24    #[error("Invalid receipt: {0}")]
25    InvalidReceipt(String),
26
27    /// Cryptographic operation failed.
28    #[error("Cryptographic error: {0}")]
29    Crypto(String),
30
31    /// Hash mismatch in chain.
32    #[error("Hash mismatch: expected {expected}, got {actual}")]
33    HashMismatch {
34        /// Expected hash value.
35        expected: String,
36        /// Actual hash value.
37        actual: String,
38    },
39}