Refactor error handling for address display
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Receive/ReceiveAddressViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Receive/ReceiveAddressViewModel.cs
@@ -86,10 +86,10 @@ public partial class ReceiveAddressViewModel : RoutableViewModel
await Task.Run(async () =>
{
+ using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
try
{
var client = new HwiClient(network);
- using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
await client.DisplayAddressAsync(masterFingerprint.Value, model.FullKeyPath, cts.Token);
}
@@ -101,7 +101,8 @@ public partial class ReceiveAddressViewModel : RoutableViewModel
catch (Exception ex)
{
Logger.LogError(ex);
- await ShowErrorAsync(Title, ex.ToUserFriendlyString(), "Unable to send the address to the device");
+ var exMessage = cts.IsCancellationRequested ? "User response didn't arrive in time." : ex.ToUserFriendlyString();
+ await ShowErrorAsync(Title, exMessage, "Unable to send the address to the device");
}
});
}
@@ -130,6 +131,7 @@ public partial class ReceiveAddressViewModel : RoutableViewModel
})
.DisposeWith(disposables);
}
+
private void GenerateQrCode()
{
try

MODIFY
WalletWasabi/Hwi/HwiClient.cs
WalletWasabi/Hwi/HwiClient.cs
@@ -56,8 +56,7 @@ public class HwiClient
}
catch (Exception ex) when (ex is OperationCanceledException or TimeoutException)
{
- Logger.LogError($"'hwi {arguments}' operation is canceled.", ex);
- throw new OperationCanceledException("User response didn't arrive in time.");
+ throw new OperationCanceledException($"'hwi {arguments}' operation is canceled.");
}
//// HWI is inconsistent with error codes here.
catch (HwiException ex) when (ex.ErrorCode is HwiErrorCode.DeviceConnError or HwiErrorCode.DeviceNotReady)

Refactor error handling for address display