1use grovedb::query_result_type::Path;
2
3#[derive(Debug, thiserror::Error)]
5pub enum ProofError {
6 #[error("too many elements error: {0}")]
8 TooManyElements(&'static str),
9
10 #[error("wrong element count error expected: {expected} got: {got}")]
12 WrongElementCount {
13 expected: usize,
15 got: usize,
17 },
18
19 #[error("overflow error: {0}")]
21 Overflow(&'static str),
22
23 #[error("corrupted error: {0}")]
26 CorruptedProof(String),
27
28 #[error("incorrect proof error: {0}")]
31 IncorrectProof(String),
32
33 #[error("unexpected result in proof error: {0}")]
38 UnexpectedResultProof(String),
39
40 #[error("invalid transition error: {0}")]
42 InvalidTransition(String),
43
44 #[error("unknown contract in documents batch transition error: {0}")]
46 UnknownContract(String),
47
48 #[error("invalid metadata: {0}")]
50 InvalidMetadata(String),
51
52 #[error("the contract could not be retrieved during verification: {0}")]
54 ErrorRetrievingContract(String),
55
56 #[error("missing context requirement error: {0}")]
58 MissingContextRequirement(String),
59
60 #[error("incomplete proof error: {0}")]
62 IncompleteProof(&'static str),
63
64 #[error("incorrect value size error: {0}")]
66 IncorrectValueSize(&'static str),
67
68 #[error("incorrect element path error")]
70 IncorrectElementPath {
71 expected: Path,
73 actual: Path,
75 },
76}
77#[allow(dead_code)]
78#[deprecated(note = "This function is marked as unused.")]
79#[allow(deprecated)]
80fn get_error_code(error: &ProofError) -> u32 {
81 match error {
82 ProofError::TooManyElements(_) => 6000,
83 ProofError::WrongElementCount { .. } => 6001,
84 ProofError::Overflow(_) => 6002,
85 ProofError::CorruptedProof(_) => 6003,
86 ProofError::IncompleteProof(_) => 6004,
87 ProofError::IncorrectValueSize(_) => 6005,
88 ProofError::IncorrectElementPath { .. } => 6006,
89 ProofError::IncorrectProof(_) => 6007,
90 ProofError::InvalidTransition(_) => 6008,
91 ProofError::UnknownContract(_) => 6009,
92 ProofError::ErrorRetrievingContract(_) => 6010,
93 ProofError::InvalidMetadata(_) => 6011,
94 ProofError::MissingContextRequirement(_) => 6012,
95 ProofError::UnexpectedResultProof(_) => 6013,
96 }
97}