Add error message for authlib-injector download failure

This commit is contained in:
yushijinhun 2018-10-06 12:06:31 +08:00
parent f3dca75a10
commit c51da28e31
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
6 changed files with 48 additions and 1 deletions

View File

@ -31,6 +31,7 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import org.jackhuang.hmcl.auth.*;
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorDownloadException;
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorServer;
import org.jackhuang.hmcl.auth.yggdrasil.GameProfile;
import org.jackhuang.hmcl.auth.yggdrasil.RemoteAuthenticationException;
@ -278,6 +279,8 @@ public class AddAccountPane extends StackPane {
return i18n("account.failed.invalid_password");
}
return exception.getMessage();
} else if (exception instanceof AuthlibInjectorDownloadException) {
return i18n("account.failed.injector_download_failure");
} else {
return exception.getClass().getName() + ": " + exception.getLocalizedMessage();
}

View File

@ -36,6 +36,7 @@ account.create=Create a new account
account.email=Email
account.failed.connect_authentication_server=Cannot connect to the authentication server. Check your network.
account.failed.connect_injector_server=Cannot connect to the authentication server. Check your network and ensure the URL is correct.
account.failed.injector_download_failure=Failed to download authlib-injector. Check your network and try switching to another download source.
account.failed.invalid_credentials=Incorrect password, or you are forbidden to login temporarily.
account.failed.invalid_password=Invalid password
account.failed.invalid_token=Please log out and re-input your password to login.

View File

@ -36,6 +36,7 @@ account.create=建立帳戶
account.email=電子信箱
account.failed.connect_authentication_server=無法連接認證伺服器,可能是網路問題
account.failed.connect_injector_server=無法連接認證伺服器,可能是網路故障或 URL 輸入錯誤
account.failed.injector_download_failure=無法下載 authlib-injector請檢查網路或嘗試切換下載源
account.failed.invalid_credentials=您的使用者名稱或密碼錯誤,或者登入次數過多被暫時禁止登入,請稍後再試
account.failed.invalid_password=無效的密碼
account.failed.invalid_token=請嘗試登出並重新輸入密碼登入

View File

@ -36,6 +36,7 @@ account.create=新建账户
account.email=邮箱
account.failed.connect_authentication_server=无法连接认证服务器,可能是网络问题
account.failed.connect_injector_server=无法连接认证服务器,可能是网络故障或 URL 输入错误
account.failed.injector_download_failure=无法下载 authlib-injector请检查网络或尝试切换下载源
account.failed.invalid_credentials=您的用户名或密码错误,或者登录次数过多被暂时禁止登录,请稍后再试
account.failed.invalid_password=无效的密码
account.failed.invalid_token=请尝试登出并重新输入密码登录

View File

@ -69,7 +69,7 @@ public class AuthlibInjectorAccount extends YggdrasilAccount {
try {
return authlibInjectorDownloader.get();
} catch (IOException e) {
throw new CompletionException(new AuthenticationException("Failed to download authlib-injector", e));
throw new CompletionException(new AuthlibInjectorDownloadException(e));
}
});

View File

@ -0,0 +1,41 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2018 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hmcl.auth.authlibinjector;
import org.jackhuang.hmcl.auth.AuthenticationException;
/**
* @author yushijinhun
*/
public class AuthlibInjectorDownloadException extends AuthenticationException {
public AuthlibInjectorDownloadException() {
}
public AuthlibInjectorDownloadException(String message, Throwable cause) {
super(message, cause);
}
public AuthlibInjectorDownloadException(String message) {
super(message);
}
public AuthlibInjectorDownloadException(Throwable cause) {
super(cause);
}
}