tg_voting_contract/
error.rs

1use cosmwasm_std::{Decimal, StdError};
2use thiserror::Error;
3
4#[derive(Error, Debug, PartialEq)]
5pub enum ContractError {
6    #[error("{0}")]
7    Std(#[from] StdError),
8
9    #[error("Group contract invalid address '{addr}'")]
10    InvalidGroup { addr: String },
11
12    #[error("Invalid voting quorum percentage, must be 0.01-1.0: {0}")]
13    InvalidQuorum(Decimal),
14
15    #[error("Invalid voting threshold percentage, must be 0.5-1.0: {0}")]
16    InvalidThreshold(Decimal),
17
18    #[error("Invalid voting period, must be 1-365 days: {0}")]
19    InvalidVotingPeriod(u32),
20
21    #[error("Proposal is not open")]
22    NotOpen {},
23
24    #[error("Proposal voting period has expired")]
25    Expired {},
26
27    #[error("Proposal must expire before you can close it")]
28    NotExpired {},
29
30    #[error("Already voted on this proposal")]
31    AlreadyVoted {},
32
33    #[error("Cannot close completed or passed proposals")]
34    WrongCloseStatus {},
35
36    #[error("Proposal must have passed and not yet been executed")]
37    WrongExecuteStatus {},
38}