Add error handling information when no endpoint is configure. Build GVA history query only if pubkey is not empty;

This commit is contained in:
poka 2021-01-11 19:46:20 +01:00
parent 0210dfd56e
commit 8ccddfeac2
2 changed files with 11 additions and 4 deletions

View File

@ -22,7 +22,7 @@ T getRandomElement<T>(List<T> list) {
} }
Future<String> getRandomEndpoint() async { Future<String> getRandomEndpoint() async {
// TODO: Improve implemention of getRandomEndpoint() with JSON and error handling // TODO: Improve implemention of getRandomEndpoint()
// final _json = json.decode(await getJsonEndpoints()); // final _json = json.decode(await getJsonEndpoints());
// print('JSON !! :'); // print('JSON !! :');
// print(_json); // print(_json);

View File

@ -110,7 +110,7 @@ class HistoryScreenState extends State<HistoryScreen> {
disabledBorder: InputBorder.none, disabledBorder: InputBorder.none,
), ),
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)), style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)),
historyQuery(), if (this.pubkey != '') historyQuery(),
])); ]));
} }
@ -138,11 +138,18 @@ class HistoryScreenState extends State<HistoryScreen> {
} }
if (result.hasException) { if (result.hasException) {
return Text('\nErrors: \n ' + result.exception.toString()); print('Error GVA: ' + result.exception.toString());
return Column(children: <Widget>[
SizedBox(height: 50),
Text(
"Aucun noeud GVA valide n'a pu être trouvé.\nVeuillez réessayer ultérieurement.",
style: TextStyle(fontSize: 17.0),
)
]);
} }
if (result.data == null && result.exception.toString() == null) { if (result.data == null && result.exception.toString() == null) {
return const Text('Both data and errors are null'); return const Text('Aucune donnée à afficher.');
} }
final List<dynamic> blockchainTX = final List<dynamic> blockchainTX =