Permalink
Browse files

improve insufficiend funds warning

  • Loading branch information...
nopara73 committed Nov 8, 2018
1 parent 53dc027 commit 0525538b140dd72439cd17c097103d3cd0fc8eaa
@@ -13,6 +13,7 @@
using WalletWasabi.Gui.ViewModels.Validation;
using WalletWasabi.Helpers;
using ReactiveUI.Legacy;
using WalletWasabi.Exceptions;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
@@ -129,6 +130,12 @@ public SendTabViewModel(WalletViewModel walletViewModel)
SuccessMessage = "Transaction is successfully sent!";
WarningMessage = "";
}
catch (InsufficientBalanceException ex)
{
SuccessMessage = "";
Money needed = ex.Minimum - ex.Actual;
WarningMessage = $"Not enough coins selected. You need an estimated {needed.ToString(false, true)} BTC more to make this transaction.";
}
catch (Exception ex)
{
SuccessMessage = "";
@@ -5,8 +5,13 @@ namespace WalletWasabi.Exceptions
{
public class InsufficientBalanceException : Exception
{
public Money Minimum { get; }
public Money Actual { get; }
public InsufficientBalanceException(Money minimum, Money actual) : base($"Needed: {minimum.ToString(false, true)} BTC, got only: {actual.ToString(false, true)} BTC.")
{
Minimum = minimum ?? Money.Zero;
Actual = actual ?? Money.Zero;
}
}
}

0 comments on commit 0525538

Please sign in to comment.