mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
handle errors more reliably
This commit is contained in:
parent
ad5f9b3de4
commit
177eb70d51
1 changed files with 6 additions and 2 deletions
|
@ -188,7 +188,10 @@ class SimplexAPI {
|
|||
}
|
||||
final jsonArray = jsonDecode(res.body);
|
||||
if (jsonArray.containsKey('error') as bool) {
|
||||
throw Exception('getQuote exception: ${jsonArray['error']}');
|
||||
if (jsonArray['error'] == true || jsonArray['error'] == 'true') {
|
||||
// jsonArray['error'] as bool == true?
|
||||
throw Exception('getQuote exception: ${jsonArray['error']}');
|
||||
}
|
||||
}
|
||||
|
||||
jsonArray['quote'] = quote; // Add and pass this on
|
||||
|
@ -273,10 +276,11 @@ class SimplexAPI {
|
|||
throw Exception('newOrder exception: statusCode= ${res.statusCode}');
|
||||
}
|
||||
final jsonArray = jsonDecode(res.body); // TODO check if valid json
|
||||
if (jsonArray.containsKey('error') as bool) {
|
||||
if (jsonArray['error'] == true || jsonArray['error'] == 'true') {
|
||||
print('error');
|
||||
throw Exception(jsonArray['message']);
|
||||
}
|
||||
}
|
||||
|
||||
SimplexOrder _order = SimplexOrder(
|
||||
quote: quote,
|
||||
|
|
Loading…
Reference in a new issue