Commit 783b576f authored by Nicolas Lenz's avatar Nicolas Lenz
Browse files

Improve error messages

parent e9324f88
......@@ -18,7 +18,7 @@ Future<List<Container1>> getContainers() async {
Iterable list = json.decode(response.body);
return list.map((alloc) => Container1.fromJson(alloc)).toList();
} else {
throw Exception("HTTP status code ${response.statusCode}");
throw Exception("Connection error (HTTP ${response.statusCode}). Please check connection.");
}
}
......@@ -29,7 +29,7 @@ Future<List<String>> getLocationsByContainer(int container) async {
Iterable list = json.decode(response.body);
return list.map((alloc) => ContainerAllocation.fromJson(alloc).location).toList();
} else {
throw Exception("HTTP status code ${response.statusCode}");
throw Exception("Connection error (HTTP ${response.statusCode}). Please check connection.");
}
}
......@@ -39,7 +39,7 @@ Future<String> addContainers(Allocation alloc) async {
if(response.statusCode == 200) {
return response.body;
} else {
return "Response status not 200";
throw Exception("Connection error (HTTP ${response.statusCode}). Please check connection.");
}
}
......@@ -54,7 +54,7 @@ Future<List<LogEntry>> getLog() async {
Iterable list = json.decode(response.body);
return list.map((log) => LogEntry.fromJson(log)).toList();
} else {
throw Exception("Broken yo");
throw Exception("Connection error (HTTP ${response.statusCode}). Please check connection.");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment