#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("password generation error : {0}")]
Password(#[from] PasswordGenerationError),
#[error("keypair generation error : ")]
Keypair(#[from] KeypairGenerationError),
#[error("mandala client error :")]
Client(#[from] MandalaClientErorr),
#[error("reserve error : ")]
Reserve(#[from] FundsReserveError),
#[error("callback executor error : ")]
Callback(#[from] CallbackExecutorError),
#[error("error when submitting transaction : {0}")]
Transaction(#[from] subxt::Error),
#[error("error when converting to payload : {0}")]
Payload(#[from] ToPayloadError),
#[error("error when signing transaction : {0}")]
Sign(#[from] TxBuilderError),
#[error("error when parsing function selector : {0}")]
Selector(#[from] SelectorError),
#[error("unit error : {0}")]
Unit(#[from] rust_decimal::Error),
}
#[derive(thiserror::Error, Debug)]
pub enum PasswordGenerationError {
#[error("invalid length. password length must be at least 32 characters long!")]
InvalidLength,
}
#[derive(thiserror::Error, Debug)]
pub enum KeypairGenerationError {
#[error("{0}")]
PublicAddress(String),
#[error("fail to generate mnemonic phrase with {0}")]
MnemonicPhrase(String),
#[error("{0}")]
PrivateKey(#[from] subxt::ext::sp_core::crypto::SecretStringError),
#[error("{0}")]
Recover(String),
}
#[derive(thiserror::Error, Debug)]
pub enum MandalaClientErorr {
#[error("connection Error : {0}")]
Connection(#[from] subxt::Error),
}
#[derive(thiserror::Error, Debug)]
pub enum FundsReserveError {
#[error("{0}")]
RpcError(#[from] subxt::error::Error),
#[error("account does not exist!")]
NonExistentAccount,
}
#[derive(thiserror::Error, Debug)]
pub enum CallbackExecutorError {
#[error("{0}")]
InvalidUrl(String),
}
#[derive(thiserror::Error, Debug)]
pub enum ToPayloadError {
#[error("{0}")]
AddressError(String),
}
#[derive(thiserror::Error, Debug)]
pub enum TxBuilderError {
#[error("{0}")]
SignErorr(#[from] subxt::Error),
}
#[derive(thiserror::Error, Debug)]
pub enum SelectorError {
#[error("invalid length. selector length must be 4 bytes long!")]
InvalidLength,
#[error("invalid hex. selector must be a valid hex string!")]
NotHex,
}