no such transaction exception

This commit is contained in:
julian 2023-01-27 12:22:30 -06:00
parent 47acad29a5
commit 2dd8a5b190
2 changed files with 15 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:decimal/decimal.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/prefs.dart';
import 'package:uuid/uuid.dart';
@ -132,7 +133,15 @@ class ElectrumX {
final response = await _rpcClient!.request(jsonRequestString);
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;

View file

@ -0,0 +1,5 @@
import 'package:stackwallet/exceptions/sw_exception.dart';
class NoSuchTransactionException extends SWException {
NoSuchTransactionException(super.message);
}