gui: display export error
This commit is contained in:
parent
29b1673460
commit
e19644ae8c
@ -60,7 +60,7 @@ impl std::fmt::Display for Error {
|
||||
Self::Unexpected(e) => write!(f, "Unexpected error: {}", e),
|
||||
Self::HardwareWallet(e) => write!(f, "error: {}\nPlease check if the device is still connected and unlocked with the correct firmware open for the current network and no other application is accessing the device.", e),
|
||||
Self::Desc(e) => write!(f, "Liana descriptor error: {}", e),
|
||||
Self::ImportExport(e) => write!(f, "{e:?}"),
|
||||
Self::ImportExport(e) => write!(f, "{e}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ impl From<&Error> for WarningMessage {
|
||||
Error::HardwareWallet(_) => WarningMessage("Hardware wallet error".to_string()),
|
||||
Error::Desc(e) => WarningMessage(format!("Descriptor analysis error: '{}'.", e)),
|
||||
Error::Spend(e) => WarningMessage(format!("Spend creation error: '{}'.", e)),
|
||||
Error::ImportExport(e) => WarningMessage(format!("{e:?}")),
|
||||
Error::ImportExport(e) => WarningMessage(format!("{e}")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +74,14 @@ pub enum Error {
|
||||
|
||||
impl Display for Error {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{self:?}")
|
||||
match self {
|
||||
Error::DescriptorMissing => write!(f, "Backup: descriptor missing"),
|
||||
Error::NotSingleWallet => write!(f, "Backup: Zero or several wallets"),
|
||||
Error::Json => write!(f, "Backup: json error"),
|
||||
Error::SettingsFromFile => write!(f, "Backup: fail to parse setting from file"),
|
||||
Error::Daemon(e) => write!(f, "Backup daemon error: {e}"),
|
||||
Error::TxTimeMissing => write!(f, "Backup: transaction block height missing"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fmt::Display,
|
||||
fs::{self, File},
|
||||
io::{Read, Write},
|
||||
path::PathBuf,
|
||||
@ -156,6 +157,27 @@ pub enum Error {
|
||||
Backup(backup::Error),
|
||||
}
|
||||
|
||||
impl Display for Error {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Error::Io(e) => write!(f, "ImportExport Io Error: {e}"),
|
||||
Error::HandleLost => write!(f, "ImportExport: subprocess handle lost"),
|
||||
Error::UnexpectedEnd => write!(f, "ImportExport: unexpected end of the process"),
|
||||
Error::JoinError(e) => write!(f, "ImportExport fail to handle.join(): {e} "),
|
||||
Error::ChannelLost => write!(f, "ImportExport: the channel have been closed"),
|
||||
Error::NoParentDir => write!(f, "ImportExport: there is no parent dir"),
|
||||
Error::Daemon(e) => write!(f, "ImportExport daemon error: {e}"),
|
||||
Error::TxTimeMissing => write!(f, "ImportExport: transaction block height missing"),
|
||||
Error::DaemonMissing => write!(f, "ImportExport: the daemon is missing"),
|
||||
Error::ParsePsbt => write!(f, "ImportExport: fail to parse PSBT"),
|
||||
Error::ParseDescriptor => write!(f, "ImportExport: fail to parse descriptor"),
|
||||
Error::Bip329Export(e) => write!(f, "Bip329Export: {e}"),
|
||||
Error::BackupImport(e) => write!(f, "BackupImport: {e}"),
|
||||
Error::Backup(e) => write!(f, "Backup: {e}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ImportExportType {
|
||||
Transactions,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user