Improve sending error messages

Ideally these should be moved to the translation strings
wow-support
Justin Ehrenhofer 1 year ago
parent a3622fa90c
commit 6c0401089a

@ -6,5 +6,5 @@ class BitcoinTransactionWrongBalanceException implements Exception {
final CryptoCurrency currency;
@override
String toString() => 'Wrong balance. Not enough ${currency.title} on your balance.';
String toString() => 'You do not have enough ${currency.title} to send this amount.';
}

@ -166,14 +166,14 @@ abstract class HavenWalletBase extends WalletBase<MoneroBalance,
if (hasMultiDestination) {
if (outputs.any((item) => item.sendAll
|| (item.formattedCryptoAmount ?? 0) <= 0)) {
throw HavenTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
throw HavenTransactionCreationException('You do not have enough coins to send this amount.');
}
final int totalAmount = outputs.fold(0, (acc, value) =>
acc + (value.formattedCryptoAmount ?? 0));
if (unlockedBalance < totalAmount) {
throw HavenTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
throw HavenTransactionCreationException('You do not have enough coins to send this amount.');
}
final moneroOutputs = outputs.map((output) =>
@ -204,7 +204,7 @@ abstract class HavenWalletBase extends WalletBase<MoneroBalance,
final formattedBalance = moneroAmountToString(amount: unlockedBalance);
throw HavenTransactionCreationException(
'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
'You do not have enough unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
}
pendingTransactionDescription =

@ -180,14 +180,14 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
if (hasMultiDestination) {
if (outputs.any((item) => item.sendAll
|| (item.formattedCryptoAmount ?? 0) <= 0)) {
throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
throw MoneroTransactionCreationException('You do not have enough XMR to send this amount.');
}
final int totalAmount = outputs.fold(0, (acc, value) =>
acc + (value.formattedCryptoAmount ?? 0));
if (unlockedBalance < totalAmount) {
throw MoneroTransactionCreationException('Wrong balance. Not enough XMR on your balance.');
throw MoneroTransactionCreationException('You do not have enough XMR to send this amount.');
}
final moneroOutputs = outputs.map((output) {
@ -222,7 +222,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
final formattedBalance = moneroAmountToString(amount: unlockedBalance);
throw MoneroTransactionCreationException(
'Incorrect unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
'You do not have enough unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
}
pendingTransactionDescription =

Loading…
Cancel
Save