mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Add better error handling for API
This commit is contained in:
parent
0f472d448b
commit
e04dadcd2f
2 changed files with 10 additions and 19 deletions
|
|
@ -134,22 +134,6 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
onConnectFailure("Could not connect to server");
|
||||
}
|
||||
|
||||
}).catchError((e) {
|
||||
|
||||
String fault = "Connection error";
|
||||
|
||||
_serverConnection = false;
|
||||
_serverStatusColor = Color.fromARGB(255, 250, 50, 50);
|
||||
|
||||
_serverStatus = "Error connecting to $_serverAddress";
|
||||
|
||||
if (e is TimeoutException) {
|
||||
fault = "Timeout: No response from server";
|
||||
} else {
|
||||
fault = e.toString();
|
||||
}
|
||||
|
||||
onConnectFailure(fault);
|
||||
});
|
||||
|
||||
// Update widget state
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue