From bab45a9e36b2e017f9649fc98a7f8d7fe278c764 Mon Sep 17 00:00:00 2001 From: cyan Date: Mon, 23 Sep 2024 18:18:21 +0200 Subject: [PATCH] add missing error messages (#1696) --- cw_bitcoin/lib/exceptions.dart | 15 +++++++++++++++ cw_core/lib/exceptions.dart | 5 +++++ .../api/exceptions/setup_wallet_exception.dart | 5 +++++ .../api/exceptions/setup_wallet_exception.dart | 3 +++ .../wallet_restore_from_keys_exception.dart | 3 +++ .../wallet_restore_from_seed_exception.dart | 3 +++ .../api/exceptions/setup_wallet_exception.dart | 3 +++ .../wallet_restore_from_keys_exception.dart | 2 ++ 8 files changed, 39 insertions(+) diff --git a/cw_bitcoin/lib/exceptions.dart b/cw_bitcoin/lib/exceptions.dart index 575a61b0b..f7c593135 100644 --- a/cw_bitcoin/lib/exceptions.dart +++ b/cw_bitcoin/lib/exceptions.dart @@ -3,6 +3,11 @@ import 'package:cw_core/exceptions.dart'; class BitcoinTransactionWrongBalanceException extends TransactionWrongBalanceException { BitcoinTransactionWrongBalanceException({super.amount}) : super(CryptoCurrency.btc); + + @override + String toString() { + return "BitcoinTransactionWrongBalanceException: $amount, $currency"; + } } class BitcoinTransactionNoInputsException extends TransactionNoInputsException {} @@ -13,10 +18,20 @@ class BitcoinTransactionNoDustException extends TransactionNoDustException {} class BitcoinTransactionNoDustOnChangeException extends TransactionNoDustOnChangeException { BitcoinTransactionNoDustOnChangeException(super.max, super.min); + + @override + String toString() { + return "BitcoinTransactionNoDustOnChangeException: max: $max, min: $min"; + } } class BitcoinTransactionCommitFailed extends TransactionCommitFailed { BitcoinTransactionCommitFailed({super.errorMessage}); + + @override + String toString() { + return errorMessage??"unknown error"; + } } class BitcoinTransactionCommitFailedDustChange extends TransactionCommitFailedDustChange {} diff --git a/cw_core/lib/exceptions.dart b/cw_core/lib/exceptions.dart index c13861698..80bdd2886 100644 --- a/cw_core/lib/exceptions.dart +++ b/cw_core/lib/exceptions.dart @@ -24,6 +24,11 @@ class TransactionCommitFailed implements Exception { final String? errorMessage; TransactionCommitFailed({this.errorMessage}); + + @override + String toString() { + return errorMessage??"unknown error"; + } } class TransactionCommitFailedDustChange implements Exception {} diff --git a/cw_haven/lib/api/exceptions/setup_wallet_exception.dart b/cw_haven/lib/api/exceptions/setup_wallet_exception.dart index b6e0c1f18..9d985665b 100644 --- a/cw_haven/lib/api/exceptions/setup_wallet_exception.dart +++ b/cw_haven/lib/api/exceptions/setup_wallet_exception.dart @@ -2,4 +2,9 @@ class SetupWalletException implements Exception { SetupWalletException({required this.message}); final String message; + + @override + String toString() { + return message; + } } \ No newline at end of file diff --git a/cw_monero/lib/api/exceptions/setup_wallet_exception.dart b/cw_monero/lib/api/exceptions/setup_wallet_exception.dart index b6e0c1f18..c0d25c62f 100644 --- a/cw_monero/lib/api/exceptions/setup_wallet_exception.dart +++ b/cw_monero/lib/api/exceptions/setup_wallet_exception.dart @@ -2,4 +2,7 @@ class SetupWalletException implements Exception { SetupWalletException({required this.message}); final String message; + + @override + String toString() => message; } \ No newline at end of file diff --git a/cw_monero/lib/api/exceptions/wallet_restore_from_keys_exception.dart b/cw_monero/lib/api/exceptions/wallet_restore_from_keys_exception.dart index c6b6c6ef7..6c461ee4c 100644 --- a/cw_monero/lib/api/exceptions/wallet_restore_from_keys_exception.dart +++ b/cw_monero/lib/api/exceptions/wallet_restore_from_keys_exception.dart @@ -2,4 +2,7 @@ class WalletRestoreFromKeysException implements Exception { WalletRestoreFromKeysException({required this.message}); final String message; + + @override + String toString() => message; } \ No newline at end of file diff --git a/cw_monero/lib/api/exceptions/wallet_restore_from_seed_exception.dart b/cw_monero/lib/api/exceptions/wallet_restore_from_seed_exception.dart index 004cd7958..904a7e767 100644 --- a/cw_monero/lib/api/exceptions/wallet_restore_from_seed_exception.dart +++ b/cw_monero/lib/api/exceptions/wallet_restore_from_seed_exception.dart @@ -2,4 +2,7 @@ class WalletRestoreFromSeedException implements Exception { WalletRestoreFromSeedException({required this.message}); final String message; + + @override + String toString() => message; } \ No newline at end of file diff --git a/cw_wownero/lib/api/exceptions/setup_wallet_exception.dart b/cw_wownero/lib/api/exceptions/setup_wallet_exception.dart index b6e0c1f18..c0d25c62f 100644 --- a/cw_wownero/lib/api/exceptions/setup_wallet_exception.dart +++ b/cw_wownero/lib/api/exceptions/setup_wallet_exception.dart @@ -2,4 +2,7 @@ class SetupWalletException implements Exception { SetupWalletException({required this.message}); final String message; + + @override + String toString() => message; } \ No newline at end of file diff --git a/cw_wownero/lib/api/exceptions/wallet_restore_from_keys_exception.dart b/cw_wownero/lib/api/exceptions/wallet_restore_from_keys_exception.dart index c6b6c6ef7..ad576faa2 100644 --- a/cw_wownero/lib/api/exceptions/wallet_restore_from_keys_exception.dart +++ b/cw_wownero/lib/api/exceptions/wallet_restore_from_keys_exception.dart @@ -2,4 +2,6 @@ class WalletRestoreFromKeysException implements Exception { WalletRestoreFromKeysException({required this.message}); final String message; + + String toString() => message; } \ No newline at end of file