Small improvements

pull/210/head
M66B 2 years ago
parent d7baa92556
commit 5433691b5e

@ -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());

@ -2471,8 +2471,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
etBody.setSelection(paragraph.second);
Throwable exex = new Throwable("DeepL", ex);
Log.unexpectedError(getParentFragmentManager(), exex, false);
Log.unexpectedError(getParentFragmentManager(), ex, false);
}
}.setExecutor(executor).execute(FragmentCompose.this, args, "compose:translate");
}

@ -133,7 +133,7 @@ public class FragmentDialogTranslate extends FragmentDialogBase {
@Override
protected void onException(Bundle args, Throwable ex) {
tvText.setText(ex.toString());
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(FragmentDialogTranslate.this, args, "translate:all");
}
@ -309,8 +309,7 @@ public class FragmentDialogTranslate extends FragmentDialogBase {
ssb.removeSpan(mark);
tvText.setText(ssb);
Throwable exex = new Throwable("DeepL", ex);
ToastEx.makeText(context, Log.formatThrowable(exex), Toast.LENGTH_LONG).show();
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(FragmentDialogTranslate.this, args, "paragraph:translate");
}

@ -40,7 +40,6 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@ -446,7 +445,7 @@ public class LanguageTool {
Log.w(ex);
}
Log.w("LT " + error);
throw new FileNotFoundException(error);
throw new IOException(error);
}
}

Loading…
Cancel
Save