Add more ThrowException
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/TransactionViewerViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/TransactionViewerViewModel.cs
@@ -66,10 +66,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
public TransactionViewerViewModel(WalletViewModel walletViewModel) : base("Transaction", walletViewModel)
{
- OpenTransactionBroadcaster = ReactiveCommand.Create(() =>
- {
- IoC.Get<IShell>().AddOrSelectDocument(() => new TransactionBroadcasterViewModel(Global));
- });
+ OpenTransactionBroadcaster = ReactiveCommand.Create(() => IoC.Get<IShell>().AddOrSelectDocument(() => new TransactionBroadcasterViewModel(Global)));
ExportBinaryPsbt = ReactiveCommand.CreateFromTask(async () =>
{
var psbtExtension = "psbt";

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletAdvancedViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletAdvancedViewModel.cs
using ReactiveUI;
using System.Collections.ObjectModel;
using System.Reactive;
-using WalletWasabi.Gui.Helpers;
+using System.Reactive.Linq;
using WalletWasabi.Logging;
+using System;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{

MODIFY
WalletWasabi.Gui/Dialogs/GenSocksServFailDialogViewModel.cs
WalletWasabi.Gui/Dialogs/GenSocksServFailDialogViewModel.cs
@@ -2,6 +2,7 @@ using AvalonStudio.Extensibility.Dialogs;
using ReactiveUI;
using WalletWasabi.Logging;
using System.Reactive.Linq;
+using System;
namespace WalletWasabi.Gui.Dialogs
{

MODIFY
WalletWasabi.Gui/Shell/Commands/ToolCommands.cs
WalletWasabi.Gui/Shell/Commands/ToolCommands.cs
@@ -28,24 +28,24 @@ namespace WalletWasabi.Gui.Shell.Commands
Global = global.Global;
var walletManagerCommand = ReactiveCommand.Create(OnWalletManager);
- var settingsCommand = ReactiveCommand.Create(() => IoC.Get<IShell>().AddOrSelectDocument(() => new SettingsViewModel(Global)));
+ var settingsCommand = ReactiveCommand.Create(() =>
+ IoC.Get<IShell>().AddOrSelectDocument(() => new SettingsViewModel(Global)));
- var transactionBroadcasterCommand = ReactiveCommand.Create(() => IoC.Get<IShell>().AddOrSelectDocument(() => new TransactionBroadcasterViewModel(Global)));
+ var transactionBroadcasterCommand = ReactiveCommand.Create(() =>
+ IoC.Get<IShell>().AddOrSelectDocument(() => new TransactionBroadcasterViewModel(Global)));
#if DEBUG
var devToolsCommand = ReactiveCommand.Create(() =>
- {
- DevToolsExtensions.OpenDevTools((Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).MainWindow);
- });
+ DevToolsExtensions.OpenDevTools((Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).MainWindow));
#endif
-
Observable
.Merge(walletManagerCommand.ThrownExceptions)
.Merge(settingsCommand.ThrownExceptions)
+ .Merge(transactionBroadcasterCommand.ThrownExceptions)
#if DEBUG
.Merge(devToolsCommand.ThrownExceptions)
#endif
- .Subscribe(OnException);
+ .Subscribe(ex => Logger.LogError(ex));
WalletManagerCommand = new CommandDefinition(
"Wallet Manager",
@@ -83,11 +83,6 @@ namespace WalletWasabi.Gui.Shell.Commands
}
}
- private void OnException(Exception ex)
- {
- Logger.LogError(ex);
- }
-
[ExportCommandDefinition("Tools.WalletManager")]
public CommandDefinition WalletManagerCommand { get; }

MODIFY
WalletWasabi.Gui/Shell/Commands/WalletCommands.cs
WalletWasabi.Gui/Shell/Commands/WalletCommands.cs
@@ -7,6 +7,8 @@ using ReactiveUI;
using System.Composition;
using WalletWasabi.Gui.Tabs.WalletManager;
using Avalonia;
+using System.Reactive.Linq;
+using WalletWasabi.Logging;
namespace WalletWasabi.Gui.Shell.Commands
{
@@ -29,6 +31,12 @@ namespace WalletWasabi.Gui.Shell.Commands
"Load Wallet",
commandIconService.GetCompletionKindImage("LoadWallet"),
ReactiveCommand.Create(OnLoadWallet));
+
+ Observable
+ .Merge(GenerateWalletCommand.GetReactiveCommand().ThrownExceptions)
+ .Merge(RecoverWalletCommand.GetReactiveCommand().ThrownExceptions)
+ .Merge(LoadWallet.GetReactiveCommand().ThrownExceptions)
+ .Subscribe(ex => Logger.LogError(ex));
}
private void OnGenerateWallet()

MODIFY
WalletWasabi.Gui/Tabs/AboutViewModel.cs
WalletWasabi.Gui/Tabs/AboutViewModel.cs
@@ -19,17 +19,9 @@ namespace WalletWasabi.Gui.Tabs
public AboutViewModel(Global global) : base(global, "About")
{
- OpenBrowserCommand = ReactiveCommand.Create<string>(x =>
- {
- try
- {
- IoHelpers.OpenBrowser(x);
- }
- catch (Exception ex)
- {
- Logger.LogError(ex);
- }
- });
+ OpenBrowserCommand = ReactiveCommand.Create<string>(x => IoHelpers.OpenBrowser(x));
+
+ OpenBrowserCommand.ThrownExceptions.Subscribe(ex => Logger.LogError(ex));
}
public Version ClientVersion => Constants.ClientVersion;

MODIFY
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
WalletWasabi.Gui/Tabs/SettingsViewModel.cs
@@ -17,6 +17,7 @@ using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Gui.ViewModels.Validation;
using WalletWasabi.Helpers;
using WalletWasabi.Models;
+using WalletWasabi.Logging;
namespace WalletWasabi.Gui.Tabs
{
@@ -140,6 +141,13 @@ namespace WalletWasabi.Gui.Tabs
});
TextBoxLostFocusCommand = ReactiveCommand.Create(Save);
+
+ Observable
+ .Merge(OpenConfigFileCommand.ThrownExceptions)
+ .Merge(LurkingWifeModeCommand.ThrownExceptions)
+ .Merge(SetClearPinCommand.ThrownExceptions)
+ .Merge(TextBoxLostFocusCommand.ThrownExceptions)
+ .Subscribe(ex => Logger.LogError(ex));
}
public override void OnOpen()

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletSuccessViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletSuccessViewModel.cs
@@ -2,6 +2,9 @@ using NBitcoin;
using ReactiveUI;
using System.Reactive;
using WalletWasabi.Gui.ViewModels;
+using WalletWasabi.Logging;
+using System;
+using System.Reactive.Linq;
namespace WalletWasabi.Gui.Tabs.WalletManager
{
@@ -13,7 +16,9 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
{
_mnemonicWords = mnemonic.ToString();
- ConfirmCommand = ReactiveCommand.Create(owner.SelectTestPassword);
+ ConfirmCommand = ReactiveCommand.Create(() => owner.SelectTestPassword());
+
+ ConfirmCommand.ThrownExceptions.Subscribe(ex => Logger.LogError(ex));
}
public string MnemonicWords

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletViewModel.cs
@@ -36,6 +36,8 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
(terms, pw) => terms && pw);
GenerateCommand = ReactiveCommand.Create(DoGenerateCommand, canGenerate);
+
+ GenerateCommand.ThrownExceptions.Subscribe(ex => Logger.LogError(ex));
}
private void DoGenerateCommand()

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
@@ -139,7 +139,8 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
OpenBrowserCommand = ReactiveCommand.Create<string>(x => IoHelpers.OpenBrowser(x));
- Observable.Merge(OpenBrowserCommand.ThrownExceptions)
+ Observable
+ .Merge(OpenBrowserCommand.ThrownExceptions)
.Merge(LoadCommand.ThrownExceptions)
.Merge(TestPasswordCommand.ThrownExceptions)
.Merge(OpenFolderCommand.ThrownExceptions)

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
@@ -93,6 +93,8 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
this.WhenAnyValue(x => x.MnemonicWords).Subscribe(UpdateSuggestions);
_suggestions = new ObservableCollection<SuggestionViewModel>();
+
+ RecoverCommand.ThrownExceptions.Subscribe(ex => Logger.LogError(ex));
}
public ErrorDescriptors ValidatePassword() => PasswordHelper.ValidatePassword(Password);

MODIFY
WalletWasabi.Gui/ViewModels/ApplicationViewModel.cs
WalletWasabi.Gui/ViewModels/ApplicationViewModel.cs
@@ -7,6 +7,7 @@ using System.Composition;
using System.Reactive;
using System.Text;
using WalletWasabi.Gui.Tabs;
+using WalletWasabi.Logging;
namespace WalletWasabi.Gui.ViewModels
{
@@ -15,9 +16,9 @@ namespace WalletWasabi.Gui.ViewModels
public ApplicationViewModel(Global global)
{
AboutCommand = ReactiveCommand.Create(() =>
- {
- IoC.Get<IShell>().AddOrSelectDocument(() => new AboutViewModel(global));
- });
+ IoC.Get<IShell>().AddOrSelectDocument(() => new AboutViewModel(global)));
+
+ AboutCommand.ThrownExceptions.Subscribe(ex => Logger.LogError(ex));
}
public ReactiveCommand<Unit, Unit> AboutCommand { get; }

MODIFY
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -209,6 +209,8 @@ namespace WalletWasabi.Gui.ViewModels
}, this.WhenAnyValue(x => x.UpdateAvailable, x => x.CriticalUpdateAvailable, (x, y) => x || y));
this.RaisePropertyChanged(nameof(UpdateCommand)); // The binding happens after the constructor. So, if the command is not in constructor, then we need this line.
+
+ UpdateCommand.ThrownExceptions.Subscribe(ex => Logger.LogError(ex));
}
public ReactiveCommand<Unit, Unit> UpdateCommand { get; set; }

MODIFY
WalletWasabi.Gui/ViewModels/WasabiDocumentTabViewModel.cs
WalletWasabi.Gui/ViewModels/WasabiDocumentTabViewModel.cs
@@ -8,6 +8,7 @@ using System;
using System.Reactive;
using System.Threading.Tasks;
using WalletWasabi.Helpers;
+using WalletWasabi.Logging;
namespace WalletWasabi.Gui.ViewModels
{
@@ -23,6 +24,8 @@ namespace WalletWasabi.Gui.ViewModels
Title = title;
Global = Guard.NotNull(nameof(global), global);
DoItCommand = ReactiveCommand.Create(DisplayActionTab);
+
+ DoItCommand.ThrownExceptions.Subscribe(ex => Logger.LogError(ex));
}
public Global Global { get; }

Add more ThrowException