use displaydoc::Display;
use ibc::core::client::types::Height;
use ibc::core::connection::types::error::ConnectionError;
use ibc::core::handler::types::error::ContextError;
use ibc::core::host::types::identifiers::ClientId;
#[derive(Debug, Display)]
pub enum RelayerError {
ClientStateNotFound { client_id: ClientId },
ClientAlreadyUpToDate {
client_id: ClientId,
source_height: Height,
destination_height: Height,
},
ClientAtHigherHeight {
client_id: ClientId,
source_height: Height,
destination_height: Height,
},
TransactionFailed(ContextError),
Connection(ConnectionError),
}
#[cfg(feature = "std")]
impl std::error::Error for RelayerError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match &self {
Self::TransactionFailed(e) => Some(e),
Self::Connection(e) => Some(e),
_ => None,
}
}
}