Log authentication exceptions

This commit is contained in:
yushijinhun 2018-11-23 23:44:45 +08:00
parent 37186439cb
commit bb0c11fa12
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4

View File

@ -63,6 +63,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import static org.jackhuang.hmcl.setting.ConfigHolder.config;
import static org.jackhuang.hmcl.util.Lang.mapOf;
import static org.jackhuang.hmcl.util.Logging.LOG;
import static org.jackhuang.hmcl.util.Pair.pair;
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
@ -145,8 +146,10 @@ public final class LauncherHelper {
try {
variables.set("account", account.logIn());
} catch (CredentialExpiredException e) {
LOG.info("Credential has expired: " + e);
variables.set("account", DialogController.logIn(account));
} catch (AuthenticationException e) {
LOG.warning("Authentication failed, try playing offline: " + e);
variables.set("account",
account.playOffline().orElseThrow(() -> e));
}