feat: show more human-readable error message when no Java Edition profile existing in MicrosoftAccount.
This commit is contained in:
@@ -365,6 +365,8 @@ public final class Accounts {
|
|||||||
} else {
|
} else {
|
||||||
return i18n("account.methods.microsoft.error.unknown", errorCode);
|
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) {
|
} else if (exception.getClass() == AuthenticationException.class) {
|
||||||
return exception.getLocalizedMessage();
|
return exception.getLocalizedMessage();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ public class MicrosoftService {
|
|||||||
.createConnection();
|
.createConnection();
|
||||||
int responseCode = conn.getResponseCode();
|
int responseCode = conn.getResponseCode();
|
||||||
if (responseCode == HTTP_NOT_FOUND) {
|
if (responseCode == HTTP_NOT_FOUND) {
|
||||||
throw new NoCharacterException();
|
throw new NoMinecraftJavaEditionProfileException();
|
||||||
} else if (responseCode != 200) {
|
} else if (responseCode != 200) {
|
||||||
throw new ResponseCodeException(new URL("https://api.minecraftservices.com/minecraft/profile"), responseCode);
|
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 final long ADD_FAMILY = 2148916238L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class NoMinecraftJavaEditionProfileException extends AuthenticationException {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error response: {"error":"invalid_grant","error_description":"The provided
|
* Error response: {"error":"invalid_grant","error_description":"The provided
|
||||||
* value for the 'redirect_uri' is not valid. The value must exactly match the
|
* value for the 'redirect_uri' is not valid. The value must exactly match the
|
||||||
|
|||||||
Reference in New Issue
Block a user