From fe8bf0a800c0f7b62bc88b53f1313f923b3f139a Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Fri, 31 Jan 2020 15:37:17 +0800 Subject: [PATCH] fix(github): throw on error --- lib/models/auth.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/models/auth.dart b/lib/models/auth.dart index b7a64f2..e93b7bb 100644 --- a/lib/models/auth.dart +++ b/lib/models/auth.dart @@ -296,8 +296,10 @@ class AuthModel with ChangeNotifier { final res = await http .get(_apiPrefix + url, headers: headers) .timeout(_timeoutDuration); - // Fimber.d(res.body); final data = json.decode(res.body); + if (res.statusCode >= 400) { + throw data['message']; + } return data; }