add more logging

This commit is contained in:
sneurlax 2024-02-09 19:10:37 -06:00
parent d63acf632d
commit e8dc77529f
2 changed files with 12 additions and 5 deletions

View file

@ -397,8 +397,8 @@ class ElectrumXClient {
if (requestStrings.length > 1) { if (requestStrings.length > 1) {
Logging.instance.log( Logging.instance.log(
"Map returned instead of a list and there are ${requestStrings.length} queued.", "ElectrumXClient.batchRequest: Map returned instead of a list and there are ${requestStrings.length} queued.",
level: LogLevel.Error); level: LogLevel.Error);
} }
// Could throw error here. // Could throw error here.
} else { } else {
@ -757,7 +757,7 @@ class ElectrumXClient {
if (response is! Map) { if (response is! Map) {
final String msg = "getTransaction($txHash) returned a non-Map response" final String msg = "getTransaction($txHash) returned a non-Map response"
" of type ${response.runtimeType}."; " of type ${response.runtimeType}.\nResponse: $response";
Logging.instance.log(msg, level: LogLevel.Fatal); Logging.instance.log(msg, level: LogLevel.Fatal);
throw Exception(msg); throw Exception(msg);
} }
@ -1032,7 +1032,14 @@ class ElectrumXClient {
blocks, blocks,
], ],
); );
return Decimal.parse(response["result"].toString()); try {
return Decimal.parse(response["result"].toString());
} catch (e, s) {
final String msg = "Error parsing fee rate. Response: $response"
"\nResult: ${response["result"]}\nError: $e\nStack trace: $s";
Logging.instance.log(msg, level: LogLevel.Fatal);
throw Exception(msg);
}
} catch (e) { } catch (e) {
rethrow; rethrow;
} }

View file

@ -192,7 +192,7 @@ class BitcoincashWallet extends Bip39HDWallet
addresses.addAll(prevOut.addresses); addresses.addAll(prevOut.addresses);
} catch (e, s) { } catch (e, s) {
Logging.instance.log( Logging.instance.log(
"Error getting prevOutJson: $s\nStack trace: $s", "Error getting prevOutJson: $e\nStack trace: $s",
level: LogLevel.Warning); level: LogLevel.Warning);
} }
} }