croncat_agents/
error.rs

1use cosmwasm_std::{Coin, StdError};
2use thiserror::Error;
3
4#[derive(Error, Debug, PartialEq)]
5pub enum ContractError {
6    #[error("{0}")]
7    Std(#[from] StdError),
8
9    #[error("{0}")]
10    CoreError(#[from] croncat_sdk_agents::error::CoreError),
11
12    #[error("Agent already registered")]
13    AgentAlreadyRegistered,
14
15    #[error("Agent not registered")]
16    AgentNotRegistered,
17
18    #[error("Agent is not active")]
19    AgentNotActive,
20
21    #[error("Agent is not in pending set")]
22    AgentNotPending,
23
24    #[error("Insufficient funds. Need a balance of at least {amount_needed:?} to cover the first few task chain fees")]
25    InsufficientFunds { amount_needed: Coin },
26
27    #[error("Contract is in paused state")]
28    ContractPaused,
29
30    #[error("Contract is in unpaused state")]
31    ContractUnpaused,
32
33    #[error("Try again later for nomination")]
34    TryLaterForNomination,
35
36    #[error("Contract method does not accept any funds")]
37    NoFundsShouldBeAttached,
38
39    #[error("Unauthorized function call")]
40    Unauthorized,
41
42    #[error("Invalid Pause Admin")]
43    InvalidPauseAdmin,
44
45    #[error("No active agents in active agent list")]
46    NoActiveAgents,
47
48    #[error("Invalid CronCat manager address")]
49    InvalidCroncatManagerAddress { addr: String },
50
51    #[error("Invalid CronCat tasks contract address")]
52    InvalidTasksContractAddress { addr: String },
53
54    #[error("Invalid version key, please update version key before calling external contracts")]
55    InvalidVersionKey {},
56
57    #[error("Unrecognised reply_id")]
58    UnrecognisedReplyId { reply_id: u64 },
59
60    #[error("An unexpected error occurred")]
61    UnexpectedError {},
62
63    #[error("Invalid callback data when deserializing data from execution result")]
64    InvalidExecuteCallbackData {},
65
66    #[error("No rewards available for withdraw")]
67    NoWithdrawRewardsAvailable {},
68
69    #[error("Invalid configuration value for: {field}")]
70    InvalidConfigurationValue { field: String },
71
72    #[error("Agent registration currently operates on a whitelist. Unauthorized.")]
73    UnapprovedAgent {},
74
75    #[error("Agent registration has already become decentralized. Public registration cannot be set to false.")]
76    DecentralizationEnabled {},
77}