dao_proposal_multiple/
error.rs1use cosmwasm_std::StdError;
2use cw_hooks::HookError;
3use cw_utils::ParseReplyError;
4use dao_voting::{reply::error::TagError, threshold::ThresholdError, veto::VetoError};
5use thiserror::Error;
6
7#[derive(Error, Debug, PartialEq)]
8pub enum ContractError {
9 #[error("{0}")]
10 Std(#[from] StdError),
11
12 #[error(transparent)]
13 ParseReplyError(#[from] ParseReplyError),
14
15 #[error("{0}")]
16 HookError(#[from] HookError),
17
18 #[error(transparent)]
19 VetoError(#[from] VetoError),
20
21 #[error("Unauthorized")]
22 Unauthorized {},
23
24 #[error("{0}")]
25 ThresholdError(#[from] ThresholdError),
26
27 #[error("{0}")]
28 VotingError(#[from] dao_voting::error::VotingError),
29
30 #[error("Suggested proposal expiration is larger than the maximum proposal duration")]
31 InvalidExpiration {},
32
33 #[error("No such proposal ({id})")]
34 NoSuchProposal { id: u64 },
35
36 #[error("Proposal is ({size}) bytes, must be <= ({max}) bytes")]
37 ProposalTooLarge { size: u64, max: u64 },
38
39 #[error("Proposal ({id}) is expired")]
40 Expired { id: u64 },
41
42 #[error("Not registered to vote (no voting power) at time of proposal creation.")]
43 NotRegistered {},
44
45 #[error("No vote exists for proposal ({id}) and voter ({voter})")]
46 NoSuchVote { id: u64, voter: String },
47
48 #[error("Already voted. This proposal does not support revoting.")]
49 AlreadyVoted {},
50
51 #[error("Already cast a vote with that option. Change your vote to revote.")]
52 AlreadyCast {},
53
54 #[error("Proposal must be in 'passed' state to be executed.")]
55 NotPassed {},
56
57 #[error("Proposal is in a tie: two or more options have the same number of votes.")]
58 Tie {},
59
60 #[error("Proposal is not expired.")]
61 NotExpired {},
62
63 #[error("Only rejected proposals may be closed.")]
64 WrongCloseStatus {},
65
66 #[error("The DAO is currently inactive, you cannot create proposals.")]
67 InactiveDao {},
68
69 #[error("Proposal must have at least two choices.")]
70 WrongNumberOfChoices {},
71
72 #[error("Must have exactly one 'none of the above' option.")]
73 NoneOption {},
74
75 #[error("No vote weights found.")]
76 NoVoteWeights {},
77
78 #[error("Invalid vote selected.")]
79 InvalidVote {},
80
81 #[error("Must have voting power to propose.")]
82 MustHaveVotingPower {},
83
84 #[error(
85 "pre-propose modules must specify a proposer. lacking one, no proposer should be specified"
86 )]
87 InvalidProposer {},
88
89 #[error("{0}")]
90 Tag(#[from] TagError),
91
92 #[error(
93 "all proposals with deposits must be completed out (closed or executed) before migration"
94 )]
95 PendingProposals {},
96
97 #[error("received a failed proposal hook reply with an invalid hook index: ({idx})")]
98 InvalidHookIndex { idx: u64 },
99
100 #[error("received a reply failure with an invalid ID: ({id})")]
101 InvalidReplyID { id: u64 },
102}