cw_orch_interchain_daemon/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#![allow(missing_docs)]

use cosmwasm_std::StdError;
use cw_orch_interchain_core::{channel::InterchainChannel, types::NetworkId, InterchainError};
use thiserror::Error;
use tonic::transport::Channel;

#[derive(Error, Debug)]
pub enum InterchainDaemonError {
    #[error(transparent)]
    InterchainError(#[from] InterchainError),

    #[error(transparent)]
    StdError(#[from] StdError),

    #[error(transparent)]
    IoError(#[from] std::io::Error),

    #[error("You have interrupted the script execution")]
    ManualInterruption,

    #[error("Error interacting with starship {0}")]
    Starship(#[from] cw_orch_starship::client::StarshipClientError),

    #[error("Error interacting with daemon {0}")]
    Daemon(#[from] cw_orch_daemon::DaemonError),

    #[error("Error validating IBC structures {0}")]
    ValidationError(#[from] ibc_relayer_types::core::ics24_host::error::ValidationError),

    #[error("Error validating IBC structures {0}")]
    ICSChannel(#[from] ibc_relayer_types::core::ics04_channel::error::Error),

    #[error("Could not find hermes container. Ensure it is running.")]
    HermesContainerNotFound,

    #[error("daemon for chain {0} not found")]
    DaemonNotFound(String),

    #[error("Channel creation events not found from chain {src_chain} on following channel : {channel:?}")]
    ChannelCreationEventsNotFound {
        src_chain: NetworkId,
        channel: InterchainChannel<Channel>,
    },

    #[error("Configuration already registered for chain {0}")]
    AlreadyRegistered(String),

    #[error(transparent)]
    Dialoguer(#[from] dialoguer::Error),
}

// impl From
impl From<InterchainDaemonError> for InterchainError {
    fn from(value: InterchainDaemonError) -> Self {
        InterchainError::GenericError(value.to_string())
    }
}