use crate::api;
use crate::core::core::transaction;
use crate::core::libtx;
use crate::impls;
use crate::keychain;
use crate::libwallet;
use epic_wallet_libwallet::Error::LibWallet;
#[derive(Clone, Eq, PartialEq, Debug, thiserror::Error)]
pub enum Error {
#[error("LibTx Error")]
LibTX(libtx::ErrorKind),
#[error("Impls Error")]
Impls(impls::Error),
#[error("LibWallet Error: {}", _1)]
LibWallet(libwallet::Error, String),
#[error("Keychain error")]
Keychain(keychain::Error),
#[error("Transaction error")]
Transaction(transaction::Error),
#[error("Secp error")]
Secp,
#[error("Wallet data error: {}", _0)]
FileWallet(&'static str),
#[error("IO error")]
IO,
#[error("Serde JSON error")]
Format,
#[error("Node API error")]
Node(api::Error),
#[error("Hyper error")]
Hyper,
#[error("Uri parsing error")]
Uri,
#[error("Duplicate transaction ID error")]
DuplicateTransactionId,
#[error("Wallet seed file exists: {}", _0)]
WalletSeedExists(String),
#[error("Wallet seed doesn't exist error")]
WalletSeedDoesntExist,
#[error("Enc/Decryption error (check password?)")]
Encryption,
#[error("BIP39 Mnemonic (word list) Error")]
Mnemonic,
#[error("{}", _0)]
ArgumentError(String),
#[error("Generic error: {}", _0)]
GenericError(String),
#[error("Too many unsuccessful attempts at reconnection")]
EpicboxReconnectLimit,
}
impl From<Error> for epic_wallet_libwallet::Error {
fn from(error: Error) -> epic_wallet_libwallet::Error {
LibWallet(error.to_string())
}
}