1use cosmwasm_std::StdError;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum MerkleTreeError {
6 #[error(transparent)]
7 Std(#[from] StdError),
8
9 #[error("Hasher: {0}")]
10 Hasher(#[from] HasherError),
11
12 #[error("Total leaf exceed maximum leaf")]
13 ExceedMaxLeaf,
14
15 #[error("The tree is already initialized")]
16 AlreadyInit,
17}
18
19#[derive(Debug, Error)]
20pub enum HasherError {
21 #[error("{0}")]
22 Custom(String),
23}
24
25impl HasherError {
26 pub fn custom(description: impl ToString) -> Self {
27 Self::Custom(description.to_string())
28 }
29}