mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-09 12:19:24 +00:00
instead of checking if it's a List, check if it's not a Map
This commit is contained in:
parent
53931eda32
commit
15a9543c9f
1 changed files with 17 additions and 19 deletions
|
@ -748,27 +748,25 @@ class ElectrumXClient {
|
|||
return {"rawtx": response["result"] as String};
|
||||
}
|
||||
|
||||
if (response is List) {
|
||||
Logging.instance.log(
|
||||
"getTransaction($txHash) returned null response",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
throw 'getTransaction($txHash) returned null response';
|
||||
} else {
|
||||
if (response["result"] == null) {
|
||||
Logging.instance.log(
|
||||
"getTransaction($txHash) returned null response",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
throw 'getTransaction($txHash) returned null response';
|
||||
}
|
||||
return Map<String, dynamic>.from(response["result"] as Map);
|
||||
if (response is! Map) {
|
||||
final String msg = "getTransaction($txHash) returned a non-Map response"
|
||||
" of type ${response.runtimeType}.";
|
||||
Logging.instance.log(msg, level: LogLevel.Fatal);
|
||||
throw Exception(msg);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
if (response["result"] == null) {
|
||||
final String msg = "getTransaction($txHash) returned null result."
|
||||
"\nResponse: $response";
|
||||
Logging.instance.log(msg, level: LogLevel.Fatal);
|
||||
throw Exception(msg);
|
||||
}
|
||||
return Map<String, dynamic>.from(response["result"] as Map);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log(
|
||||
"getTransaction($txHash) response: $response",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
"getTransaction($txHash) response: $response"
|
||||
"\nError: $e\nStack trace: $s",
|
||||
level: LogLevel.Error);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue