bolt_cw_sdk/cosmos_client/
error.rs1use crate::tx_builder::error::TxBuilderError;
2use cosmrs::proto::prost;
3use std::num::NonZeroU32;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
7pub enum CosmosClientError {
8 #[error("Tendermint Error: {0}")]
9 Tendermint(#[from] tendermint_rpc::Error),
10 #[error("Cosmrs tendermint Error: {0}")]
11 Cosmrs(#[from] cosmrs::tendermint::Error),
12 #[error("Eyre Error: {0}")]
13 Eyre(#[from] eyre::Report),
14 #[error("Prost Error: {0}")]
15 Prost(#[from] prost::DecodeError),
16 #[error("SerdeJson Error: {0}")]
17 SerdeJson(#[from] serde_json::Error),
18 #[error("Tokio Join Error: {0}")]
19 TokioJoin(#[from] tokio::task::JoinError),
20 #[error("Cosmwasm Error: {0}")]
21 CosmwasmError(#[from] cosmwasm_std::StdError),
22 #[error("TxBuilder Error: {0}")]
23 TxBuilder(#[from] TxBuilderError),
24
25 #[error("Account with address not found: {0}")]
26 AccountNotFound(String),
27 #[error("Error while broadcasting transaction: {0}")]
28 BroadcastTx(String),
29 #[error("Insufficient gas: GasWanted {0} - GasUsed {1}")]
30 InsufficientGas(i64, i64),
31 #[error("Insufficient fee: {0}")]
32 InsufficientFee(String),
33 #[error("Failed to find bolt event attribute")]
34 FailedToFindBoltEventAttribute,
35 #[error("Failed to parse bold event value")]
36 FailedToParseBoltEventValue,
37 #[error("No data from contract query returned. Logs: {0}")]
38 NoDataFromContractQuery(String),
39 #[error("No gas info returned from simulation")]
40 NoGasInfo,
41 #[error("Unable to connect to Cosmos RPC")]
42 ConnectionError,
43 #[error("Gas simulation error with code {code}: {log}")]
44 GasSimulationError { code: NonZeroU32, log: String },
45}
46
47impl CosmosClientError {
48 pub fn no_data_returned_from_contract(&self) -> bool {
49 matches!(self, Self::NoDataFromContractQuery(_))
50 }
51}