feat: add onError exception (#1743)
Some checks failed
Cache Dependencies / test (push) Has been cancelled

This commit is contained in:
Rafael 2024-10-10 11:10:12 -03:00 committed by GitHub
parent 62f55ae8f5
commit 8acf8bdfb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1825,6 +1825,8 @@ abstract class ElectrumWalletBase
Future<Map<String, ElectrumTransactionInfo>> _fetchAddressHistory(
BitcoinAddressRecord addressRecord, int? currentHeight) async {
String txid = "";
try {
final Map<String, ElectrumTransactionInfo> historiesWithDetails = {};
@ -1834,7 +1836,7 @@ abstract class ElectrumWalletBase
addressRecord.setAsUsed();
await Future.wait(history.map((transaction) async {
final txid = transaction['tx_hash'] as String;
txid = transaction['tx_hash'] as String;
final height = transaction['height'] as int;
final storedTx = transactionHistory.transactions[txid];
@ -1865,8 +1867,12 @@ abstract class ElectrumWalletBase
}
return historiesWithDetails;
} catch (e) {
print(e.toString());
} catch (e, stacktrace) {
_onError?.call(FlutterErrorDetails(
exception: "$txid - $e",
stack: stacktrace,
library: this.runtimeType.toString(),
));
return {};
}
}