feat: show more human-readable error message when no Java Edition profile existing in MicrosoftAccount.

This commit is contained in:
huanghongxun 2021-09-05 19:50:48 +08:00
parent 47540e7f91
commit 21e28ab038
2 changed files with 6 additions and 1 deletions

View File

@ -365,6 +365,8 @@ public final class Accounts {
} else {
return i18n("account.methods.microsoft.error.unknown", errorCode);
}
} else if (exception instanceof MicrosoftService.NoMinecraftJavaEditionProfileException) {
return i18n("account.methods.microsoft.error.no_character");
} else if (exception.getClass() == AuthenticationException.class) {
return exception.getLocalizedMessage();
} else {

View File

@ -271,7 +271,7 @@ public class MicrosoftService {
.createConnection();
int responseCode = conn.getResponseCode();
if (responseCode == HTTP_NOT_FOUND) {
throw new NoCharacterException();
throw new NoMinecraftJavaEditionProfileException();
} else if (responseCode != 200) {
throw new ResponseCodeException(new URL("https://api.minecraftservices.com/minecraft/profile"), responseCode);
}
@ -320,6 +320,9 @@ public class MicrosoftService {
public static final long ADD_FAMILY = 2148916238L;
}
public static class NoMinecraftJavaEditionProfileException extends AuthenticationException {
}
/**
* Error response: {"error":"invalid_grant","error_description":"The provided
* value for the 'redirect_uri' is not valid. The value must exactly match the