mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-08 19:59:29 +00:00
better error handling
This commit is contained in:
parent
68734132a1
commit
b36c98f003
1 changed files with 13 additions and 6 deletions
|
@ -501,12 +501,19 @@ abstract class EthereumAPI {
|
|||
if (response.statusCode == 200) {
|
||||
final json = jsonDecode(response.body) as Map;
|
||||
if (json["success"] == true) {
|
||||
return EthereumResponse(
|
||||
GasTracker.fromJson(
|
||||
Map<String, dynamic>.from(json["result"]["result"] as Map),
|
||||
),
|
||||
null,
|
||||
);
|
||||
try {
|
||||
return EthereumResponse(
|
||||
GasTracker.fromJson(
|
||||
Map<String, dynamic>.from(json["result"]["result"] as Map),
|
||||
),
|
||||
null,
|
||||
);
|
||||
} catch (_) {
|
||||
throw EthApiException(
|
||||
"getGasOracle() failed with response: "
|
||||
"${response.body}",
|
||||
);
|
||||
}
|
||||
} else {
|
||||
throw EthApiException(
|
||||
"getGasOracle() failed with response: "
|
||||
|
|
Loading…
Reference in a new issue