Skip to main content

cashu/nuts/nut10/
error.rs

1//! Error types for NUT-10: Spending Conditions
2
3use thiserror::Error;
4
5use crate::nuts::{nut01, nut11, nut14};
6use crate::util::hex;
7
8/// NUT10 Error
9#[derive(Debug, Error)]
10pub enum Error {
11    /// Unknown Kind
12    #[error("Kind not found")]
13    KindNotFound,
14    /// Tag value not found
15    #[error("Tag value not found")]
16    TagValueNotFound,
17    /// Incorrect secret kind
18    #[error("Incorrect secret kind")]
19    IncorrectSecretKind,
20    /// Spend conditions not met
21    #[error("Spend conditions are not met")]
22    SpendConditionsNotMet,
23    /// Proof does not contain enough signature for lock
24    #[error("proof does not contain enough proofs to be spendable")]
25    NotEnoughSignatures,
26
27    /// From hex error
28    #[error(transparent)]
29    HexError(#[from] hex::Error),
30    /// Parse int error
31    #[error(transparent)]
32    ParseInt(#[from] std::num::ParseIntError),
33    /// Serde Json error
34    #[error(transparent)]
35    SerdeJsonError(#[from] serde_json::Error),
36    /// Secret error
37    #[error(transparent)]
38    Secret(#[from] crate::secret::Error),
39
40    /// NUT01 Error
41    #[error(transparent)]
42    NUT01(#[from] nut01::Error),
43    /// NUT11 Error
44    #[error(transparent)]
45    NUT11(#[from] nut11::Error),
46    /// NUT14 Error
47    #[error(transparent)]
48    NUT14(#[from] nut14::Error),
49}