Skip to main content

astro_satellite/
error.rs

1use cosmwasm_std::StdError;
2use thiserror::Error;
3
4use astroport_ibc::{SIGNAL_OUTAGE_LIMITS, TIMEOUT_LIMITS};
5
6/// Never is a placeholder to ensure we don't return any errors
7#[derive(Error, Debug)]
8pub enum Never {}
9
10#[derive(Debug, Error, PartialEq)]
11pub enum ContractError {
12    #[error("{0}")]
13    Std(#[from] StdError),
14
15    #[error("Contract can't be migrated!")]
16    MigrationError {},
17
18    #[error("Unauthorized")]
19    Unauthorized {},
20
21    #[error("Invalid reply id")]
22    InvalidReplyId {},
23
24    #[error("Channel already established: {channel_id}")]
25    ChannelAlreadyEstablished { channel_id: String },
26
27    #[error("Invalid governance channel: {invalid}. Should be {valid}")]
28    InvalidGovernanceChannel { invalid: String, valid: String },
29
30    #[error("Governance is not established yet")]
31    GovernanceChannelNotFound {},
32
33    #[error("Invalid source port {invalid}. Should be : {valid}")]
34    InvalidSourcePort { invalid: String, valid: String },
35
36    #[error("Messages check passed. Nothing was committed to the blockchain")]
37    MessagesCheckPassed {},
38
39    #[error("The gov_channel and the accept_new_connections settings cannot be specified at the same time")]
40    UpdateChannelError {},
41
42    #[error(
43        "Timeout must be within limits ({0} <= timeout <= {1})",
44        TIMEOUT_LIMITS.start(),
45        TIMEOUT_LIMITS.end()
46    )]
47    TimeoutLimitsError {},
48    #[error(
49        "Signal outage must be within limits ({0} <= outage <= {1})",
50        SIGNAL_OUTAGE_LIMITS.start(),
51        SIGNAL_OUTAGE_LIMITS.end()
52    )]
53    SignalOutageLimitsError {},
54
55    #[error("Satellite doesn't have any ASTRO in balance")]
56    NoAstroBalance {},
57}