diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/authenticator/microsoft/MicrosoftBackgroundLogin.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/authenticator/microsoft/MicrosoftBackgroundLogin.java
index 3722a46a1..c94694d50 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/authenticator/microsoft/MicrosoftBackgroundLogin.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/authenticator/microsoft/MicrosoftBackgroundLogin.java
@@ -192,7 +192,7 @@ public class MicrosoftBackgroundLogin {
}
/** @return [uhs, token]*/
- private String[] acquireXsts(String xblToken) throws IOException, JSONException, PresentedException {
+ private String[] acquireXsts(String xblToken) throws IOException, JSONException {
URL url = new URL(xstsAuthUrl);
JSONObject data = new JSONObject();
@@ -268,7 +268,7 @@ public class MicrosoftBackgroundLogin {
return null;
}
- private void checkMcProfile(String mcAccessToken) throws IOException, JSONException, PresentedException {
+ private void checkMcProfile(String mcAccessToken) throws IOException, JSONException {
URL url = new URL(mcProfileUrl);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
@@ -309,7 +309,7 @@ public class MicrosoftBackgroundLogin {
/** Set common properties, and enable interactivity if desired */
- private static void setCommonProperties(HttpURLConnection conn, String formData, boolean interactive){
+ private static void setCommonProperties(HttpURLConnection conn, String formData, boolean interactive) {
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Accept", "application/json");
conn.setRequestProperty("charset", "utf-8");
@@ -341,6 +341,9 @@ public class MicrosoftBackgroundLogin {
private void throwResponseError(HttpURLConnection conn) throws IOException {
Log.i("MicrosoftLogin", "Error code: " + conn.getResponseCode() + ": " + conn.getResponseMessage());
+ if(conn.getResponseCode() == 429) {
+ throw new PresentedException(R.string.microsoft_login_retry_later);
+ }
throw new RuntimeException(conn.getResponseMessage());
}
}
diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/authenticator/microsoft/PresentedException.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/authenticator/microsoft/PresentedException.java
index 90beb1408..7842379c4 100644
--- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/authenticator/microsoft/PresentedException.java
+++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/authenticator/microsoft/PresentedException.java
@@ -2,7 +2,7 @@ package net.kdt.pojavlaunch.authenticator.microsoft;
import android.content.Context;
-public class PresentedException extends Exception {
+public class PresentedException extends RuntimeException {
final int localizationStringId;
final Object[] extraArgs;
diff --git a/app_pojavlauncher/src/main/res/values/strings.xml b/app_pojavlauncher/src/main/res/values/strings.xml
index 11845fde9..5e6d8bad2 100644
--- a/app_pojavlauncher/src/main/res/values/strings.xml
+++ b/app_pojavlauncher/src/main/res/values/strings.xml
@@ -348,4 +348,5 @@
Enable gyro controls first to use this!
Gyroscope sampling rate
If you have performance issues with the gyroscope controls, increase this
+ Too many requests, please try again later.