Skip to main content

veilocity_core/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum CoreError {
5    #[error("Invalid Merkle proof")]
6    InvalidMerkleProof,
7
8    #[error("Account not found: {0}")]
9    AccountNotFound(String),
10
11    #[error("Insufficient balance: have {have}, need {need}")]
12    InsufficientBalance { have: u128, need: u128 },
13
14    #[error("Nullifier already used: {0}")]
15    NullifierUsed(String),
16
17    #[error("Database error: {0}")]
18    Database(#[from] rusqlite::Error),
19
20    #[error("Serialization error: {0}")]
21    Serialization(#[from] serde_json::Error),
22
23    #[error("Invalid field element")]
24    InvalidFieldElement,
25
26    #[error("Tree full")]
27    TreeFull,
28
29    #[error("Invalid secret key")]
30    InvalidSecretKey,
31
32    #[error("IO error: {0}")]
33    Io(#[from] std::io::Error),
34}