mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
API error messages now use snackIcon
- Press "details" for further error information - Is nice
This commit is contained in:
parent
8ae4d2b584
commit
00943b7536
9 changed files with 108 additions and 109 deletions
|
|
@ -148,7 +148,6 @@ class InvenTreeModel {
|
|||
|
||||
if (e is SocketException) {
|
||||
showServerError(
|
||||
context,
|
||||
I18N.of(context).connectionRefused,
|
||||
e.toString()
|
||||
);
|
||||
|
|
@ -168,7 +167,7 @@ class InvenTreeModel {
|
|||
}
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
showStatusCodeError(context, response.statusCode);
|
||||
showStatusCodeError(response.statusCode);
|
||||
print("Error retrieving data");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -195,7 +194,6 @@ class InvenTreeModel {
|
|||
|
||||
if (e is SocketException) {
|
||||
showServerError(
|
||||
context,
|
||||
I18N.of(context).connectionRefused,
|
||||
e.toString()
|
||||
);
|
||||
|
|
@ -212,7 +210,7 @@ class InvenTreeModel {
|
|||
if (response == null) return false;
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
showStatusCodeError(context, response.statusCode);
|
||||
showStatusCodeError(response.statusCode);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +246,7 @@ class InvenTreeModel {
|
|||
.catchError((e) {
|
||||
|
||||
if (e is SocketException) {
|
||||
showServerError(context, I18N.of(context).connectionRefused, e.toString());
|
||||
showServerError(I18N.of(context).connectionRefused, e.toString());
|
||||
}
|
||||
else if (e is TimeoutException) {
|
||||
showTimeoutError(context);
|
||||
|
|
@ -264,7 +262,7 @@ class InvenTreeModel {
|
|||
}
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
showStatusCodeError(context, response.statusCode);
|
||||
showStatusCodeError(response.statusCode);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -293,7 +291,6 @@ class InvenTreeModel {
|
|||
|
||||
if (e is SocketException) {
|
||||
showServerError(
|
||||
context,
|
||||
I18N.of(context).connectionRefused,
|
||||
e.toString()
|
||||
);
|
||||
|
|
@ -313,7 +310,7 @@ class InvenTreeModel {
|
|||
var decoded = json.decode(response.body);
|
||||
_model = createFromJson(decoded);
|
||||
} else {
|
||||
showStatusCodeError(context, response.statusCode);
|
||||
showStatusCodeError(response.statusCode);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -346,7 +343,6 @@ class InvenTreeModel {
|
|||
|
||||
if (e is SocketException) {
|
||||
showServerError(
|
||||
context,
|
||||
I18N.of(context).connectionRefused,
|
||||
e.toString()
|
||||
);
|
||||
|
|
@ -369,7 +365,7 @@ class InvenTreeModel {
|
|||
List<InvenTreeModel> results = new List<InvenTreeModel>();
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
showStatusCodeError(context, response.statusCode);
|
||||
showStatusCodeError(response.statusCode);
|
||||
|
||||
// Return empty list
|
||||
return results;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue