1#![allow(missing_docs)]
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum CosmScriptError {
7 #[error("Reqwest HTTP(s) Error")]
8 ReqwestError(#[from] ::reqwest::Error),
9 #[error("JSON Conversion Error")]
10 SerdeJson(#[from] ::serde_json::Error),
11 #[error("Decimal Conversion Error")]
12 RustDecimal(#[from] ::rust_decimal::Error),
13 #[error(transparent)]
14 ParseIntError(#[from] std::num::ParseIntError),
15 #[error(transparent)]
16 IOErr(#[from] ::std::io::Error),
17 #[error(transparent)]
18 Secp256k1(#[from] ::secp256k1::Error),
19 #[error(transparent)]
20 VarError(#[from] ::std::env::VarError),
21 #[error(transparent)]
22 AnyError(#[from] ::anyhow::Error),
23 #[error(transparent)]
24 Status(#[from] ::tonic::Status),
25 #[error(transparent)]
26 TransportError(#[from] ::tonic::transport::Error),
27 #[error(transparent)]
28 TendermintError(#[from] ::cosmrs::tendermint::Error),
29 #[error("Bech32 Decode Error")]
30 Bech32DecodeErr,
31 #[error("Bech32 Decode Error: Key Failed prefix {0} or length {1} Wanted:{2}/{3}")]
32 Bech32DecodeExpanded(String, usize, String, usize),
33 #[error("Mnemonic - Bad Phrase")]
34 Phrasing,
35 #[error("Mnemonic - Missing Phrase")]
36 MissingPhrase,
37 #[error("Bad Implementation. Missing Component")]
38 Implementation,
39 #[error("Unable to convert into public key `{key}`")]
40 Conversion {
41 key: String,
42 source: bitcoin::bech32::Error,
43 },
44 #[error(transparent)]
45 ErrReport(#[from] ::eyre::ErrReport),
46 #[error(transparent)]
47 ED25519(#[from] ::ed25519_dalek::ed25519::Error),
48 #[error(transparent)]
49 DecodeError(#[from] ::base64::DecodeError),
50 #[error(transparent)]
51 HexError(#[from] ::hex::FromHexError),
52 #[error(transparent)]
53 BitCoinBip32(#[from] ::bitcoin::util::bip32::Error),
54 #[error("83 length-missing SECP256K1 prefix")]
55 ConversionSECP256k1,
56 #[error("82 length-missing ED25519 prefix")]
57 ConversionED25519,
58 #[error("Expected Key length of 82 or 83 length was {0}")]
59 ConversionLength(usize),
60 #[error("Expected Key length of 40 length was {0}")]
61 ConversionLengthED25519Hex(usize),
62 #[error("Expected ED25519 key of length 32 with a BECH32 ED25519 prefix of 5 chars - Len {0} - Hex {1}")]
63 ConversionPrefixED25519(usize, String),
64 #[error("Can't call Transactions without some gas rules")]
65 NoGasOpts,
66 #[error("Can't parse `{parse}` into a coin")]
67 CoinParseErrV { parse: String },
68 #[error("Can't parse `{0}` into a coin")]
69 CoinParseErr(String),
70 #[error("TX submit returned `{0}` - {1} '{2}'")]
71 TxResultError(usize, String, String),
72 #[error("No price found for Gas using denom {0}")]
73 GasPriceError(String),
74 #[error("Attempting to fetch validator set in parts, and failed Height mismatch {0} {1}")]
75 TendermintValidatorSet(u64, u64),
76 #[error("Transaction {0} not found after {1} attempts")]
77 TXNotFound(String, usize),
78 #[error("unknown Terra-Rust API error")]
79 Unknown,
80 #[error("Generic Error {0}")]
81 StdErr(String),
82
83 #[error("Contract address for {0} not found in file")]
84 AddrNotInFile(String),
85 #[error("Code id for {0} not found in file")]
86 CodeIdNotInFile(String),
87 #[error("calling contract with unimplemented action")]
88 NotImplemented,
89 #[error("new chain detected, fill out the scaffold at {0}")]
90 NewChain(String),
91 #[error("new network detected, fill out the scaffold at {0}")]
92 NewNetwork(String),
93}