Log authentication exceptions

This commit is contained in:
yushijinhun
2018-11-23 23:44:45 +08:00
parent 37186439cb
commit bb0c11fa12

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