From 3a30a36ce5f58e8ae2c92926384d76253e702894 Mon Sep 17 00:00:00 2001 From: edouardparis Date: Fri, 2 Feb 2024 11:32:39 +0100 Subject: [PATCH] gui: do not display hw error on simple user refusal close #937 --- gui/src/app/state/psbt.rs | 6 +++++- gui/src/app/state/settings/wallet.rs | 6 +++++- gui/src/installer/step/descriptor.rs | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gui/src/app/state/psbt.rs b/gui/src/app/state/psbt.rs index 3d18db5a..66c5a3e4 100644 --- a/gui/src/app/state/psbt.rs +++ b/gui/src/app/state/psbt.rs @@ -477,7 +477,11 @@ impl Action for SignAction { Message::Signed(fingerprint, res) => { self.signing.remove(&fingerprint); match res { - Err(e) => self.error = Some(e), + Err(e) => { + if !matches!(e, Error::HardwareWallet(async_hwi::Error::UserRefused)) { + self.error = Some(e) + } + } Ok(psbt) => { self.error = None; self.signed.insert(fingerprint); diff --git a/gui/src/app/state/settings/wallet.rs b/gui/src/app/state/settings/wallet.rs index 8686a980..85128297 100644 --- a/gui/src/app/state/settings/wallet.rs +++ b/gui/src/app/state/settings/wallet.rs @@ -264,7 +264,11 @@ impl RegisterWalletModal { self.registered.insert(fingerprint); return Command::perform(async {}, |_| Message::LoadWallet); } - Err(e) => self.warning = Some(e), + Err(e) => { + if !matches!(e, Error::HardwareWallet(async_hwi::Error::UserRefused)) { + self.warning = Some(e) + } + } } Command::none() } diff --git a/gui/src/installer/step/descriptor.rs b/gui/src/installer/step/descriptor.rs index e82082c2..81aa6114 100644 --- a/gui/src/installer/step/descriptor.rs +++ b/gui/src/installer/step/descriptor.rs @@ -1437,7 +1437,11 @@ impl Step for RegisterDescriptor { self.hmacs.push((fingerprint, *hw_h.kind(), hmac)); } } - Err(e) => self.error = Some(e), + Err(e) => { + if !matches!(e, Error::HardwareWallet(async_hwi::Error::UserRefused)) { + self.error = Some(e) + } + } } } Message::Reload => {