mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-22 15:19:11 +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) {
|
if (response.statusCode == 200) {
|
||||||
final json = jsonDecode(response.body) as Map;
|
final json = jsonDecode(response.body) as Map;
|
||||||
if (json["success"] == true) {
|
if (json["success"] == true) {
|
||||||
return EthereumResponse(
|
try {
|
||||||
GasTracker.fromJson(
|
return EthereumResponse(
|
||||||
Map<String, dynamic>.from(json["result"]["result"] as Map),
|
GasTracker.fromJson(
|
||||||
),
|
Map<String, dynamic>.from(json["result"]["result"] as Map),
|
||||||
null,
|
),
|
||||||
);
|
null,
|
||||||
|
);
|
||||||
|
} catch (_) {
|
||||||
|
throw EthApiException(
|
||||||
|
"getGasOracle() failed with response: "
|
||||||
|
"${response.body}",
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw EthApiException(
|
throw EthApiException(
|
||||||
"getGasOracle() failed with response: "
|
"getGasOracle() failed with response: "
|
||||||
|
|
Loading…
Reference in a new issue