improvement(gitlab): catch server error
This commit is contained in:
parent
1aa7f0d130
commit
31e945cf5f
|
@ -151,6 +151,7 @@ class AuthModel with ChangeNotifier {
|
|||
final res = await http.get('${activeAccount.domain}/api/v4$p',
|
||||
headers: {'Private-Token': token});
|
||||
final info = json.decode(utf8.decode(res.bodyBytes));
|
||||
if (info['message'] != null) throw info['message'];
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -160,6 +161,7 @@ class AuthModel with ChangeNotifier {
|
|||
final next = int.tryParse(
|
||||
res.headers['X-Next-Pages'] ?? res.headers['x-next-page'] ?? '');
|
||||
final info = json.decode(utf8.decode(res.bodyBytes));
|
||||
if (info['message'] != null) throw info['message'];
|
||||
return DataWithPage(info, next, next != null);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue