restructure HTTP error handling

General cleanup and restructuring of HTTP error handling.

The new code separates IOExceptions from failed HTTP communications
and allows handling of HTTP errors later in the code.
This commit is contained in:
Grische
2022-02-19 02:42:33 +01:00
parent 572ee8469c
commit 72b1e5c662
2 changed files with 80 additions and 77 deletions

View File

@@ -61,6 +61,7 @@ public class Error {
PATH_INVALID(102),
NO_WRITE_PERMISSION(103),
SERVER_DOWN(104),
ERROR_BAD_SERVER_RESPONSE(105),
;
private final int id;
@@ -161,6 +162,8 @@ public class Error {
switch (in) {
case ERROR_BAD_UPLOAD_RESPONSE:
return "Corrupt response from the server when trying to upload data. The server might be overloaded or be encountering other issues. Will try again in a few minutes.";
case ERROR_BAD_SERVER_RESPONSE:
return "Unexpected response from server received. The server might be overloaded or encountering other issues.";
case NETWORK_ISSUE:
return "Could not connect to the server, please check your connection to the internet.";
case SERVER_DOWN: