diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java index 91beb47db..8688afbe3 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java @@ -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 { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/microsoft/MicrosoftService.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/microsoft/MicrosoftService.java index 1af3d4a40..5db3aedd2 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/microsoft/MicrosoftService.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/microsoft/MicrosoftService.java @@ -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