mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-25 08:38:45 +00:00
no such transaction exception
This commit is contained in:
parent
47acad29a5
commit
2dd8a5b190
2 changed files with 15 additions and 1 deletions
|
@ -4,6 +4,7 @@ import 'dart:io';
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
import 'package:decimal/decimal.dart';
|
import 'package:decimal/decimal.dart';
|
||||||
import 'package:stackwallet/electrumx_rpc/rpc.dart';
|
import 'package:stackwallet/electrumx_rpc/rpc.dart';
|
||||||
|
import 'package:stackwallet/exceptions/electrumx/no_such_transaction.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/prefs.dart';
|
import 'package:stackwallet/utilities/prefs.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
|
@ -132,7 +133,15 @@ class ElectrumX {
|
||||||
final response = await _rpcClient!.request(jsonRequestString);
|
final response = await _rpcClient!.request(jsonRequestString);
|
||||||
|
|
||||||
if (response["error"] != null) {
|
if (response["error"] != null) {
|
||||||
throw Exception("JSONRPC response error: $response");
|
if (response["error"]
|
||||||
|
.toString()
|
||||||
|
.contains("No such mempool or blockchain transaction")) {
|
||||||
|
throw NoSuchTransactionException(
|
||||||
|
"No such mempool or blockchain transaction: ${args.first}");
|
||||||
|
}
|
||||||
|
|
||||||
|
throw Exception(
|
||||||
|
"JSONRPC response \ncommand: $command \nargs: $args \nerror: $response");
|
||||||
}
|
}
|
||||||
|
|
||||||
currentFailoverIndex = -1;
|
currentFailoverIndex = -1;
|
||||||
|
|
5
lib/exceptions/electrumx/no_such_transaction.dart
Normal file
5
lib/exceptions/electrumx/no_such_transaction.dart
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import 'package:stackwallet/exceptions/sw_exception.dart';
|
||||||
|
|
||||||
|
class NoSuchTransactionException extends SWException {
|
||||||
|
NoSuchTransactionException(super.message);
|
||||||
|
}
|
Loading…
Reference in a new issue