mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-04 06:20:26 +00:00
DeepL: error handling
This commit is contained in:
parent
d265036cba
commit
b279bf7495
1 changed files with 13 additions and 0 deletions
|
@ -2055,6 +2055,19 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
connection.getOutputStream().write(request.getBytes());
|
connection.getOutputStream().write(request.getBytes());
|
||||||
|
|
||||||
|
int status = connection.getResponseCode();
|
||||||
|
if (status != HttpsURLConnection.HTTP_OK) {
|
||||||
|
String error;
|
||||||
|
try {
|
||||||
|
error = Helper.readStream(connection.getErrorStream());
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.w(ex);
|
||||||
|
error = ex.getMessage();
|
||||||
|
}
|
||||||
|
throw new FileNotFoundException("Error " + status + ": " + error);
|
||||||
|
}
|
||||||
|
|
||||||
String response = Helper.readStream(connection.getInputStream());
|
String response = Helper.readStream(connection.getInputStream());
|
||||||
|
|
||||||
JSONObject jroot = new JSONObject(response);
|
JSONObject jroot = new JSONObject(response);
|
||||||
|
|
Loading…
Reference in a new issue