Small improvements

This commit is contained in:
M66B
2022-12-12 19:48:11 +01:00
parent d7baa92556
commit 5433691b5e
4 changed files with 7 additions and 11 deletions

View File

@@ -50,7 +50,6 @@ import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -235,7 +234,7 @@ public class DeepL {
} catch (Throwable ex) {
Log.w(ex);
}
throw new FileNotFoundException(error);
throw new IOException(error);
}
String response = Helper.readStream(connection.getInputStream());
@@ -243,7 +242,7 @@ public class DeepL {
JSONObject jroot = new JSONObject(response);
JSONArray jtranslations = jroot.getJSONArray("translations");
if (jtranslations.length() == 0)
throw new FileNotFoundException();
throw new IOException();
JSONObject jtranslation = (JSONObject) jtranslations.get(0);
Translation result = new Translation();
@@ -292,7 +291,7 @@ public class DeepL {
} catch (Throwable ex) {
Log.w(ex);
}
throw new FileNotFoundException(error);
throw new IOException(error);
}
String response = Helper.readStream(connection.getInputStream());