Show helpful toast if someone hits a 404

This commit is contained in:
hunteraraujo
2023-09-28 23:43:02 -07:00
parent 88a4d1a0dd
commit 8c58df706a
8 changed files with 69 additions and 32 deletions

View File

@@ -50,7 +50,9 @@ class RestApiUtility {
if (response.statusCode == 200 || response.statusCode == 201) {
return json.decode(response.body);
} else {
throw Exception('Failed to post data');
// TODO: We are bubbling up the full response to show better errors on the UI.
// Let's put some thought into how we would like to structure this.
throw response;
}
}
@@ -66,8 +68,6 @@ class RestApiUtility {
if (response.statusCode == 200 || response.statusCode == 201) {
return json.decode(response.body);
} else {
print(response.statusCode);
print(response.body);
throw Exception('Failed to update data with PUT request');
}
}