Print exception name when failing to load state fiel

This commit is contained in:
AsamK 2021-02-27 17:43:19 +01:00
parent 17d6b256e8
commit 86711b0e5c

View file

@ -181,7 +181,11 @@ public class App {
try { try {
manager = RegistrationManager.init(username, dataPath, serviceEnvironment, BaseConfig.USER_AGENT); manager = RegistrationManager.init(username, dataPath, serviceEnvironment, BaseConfig.USER_AGENT);
} catch (Throwable e) { } catch (Throwable e) {
throw new UnexpectedErrorException("Error loading or creating state file: " + e.getMessage()); throw new UnexpectedErrorException("Error loading or creating state file: "
+ e.getMessage()
+ " ("
+ e.getClass().getSimpleName()
+ ")");
} }
try (var m = manager) { try (var m = manager) {
command.handleCommand(ns, m); command.handleCommand(ns, m);
@ -234,7 +238,13 @@ public class App {
} catch (NotRegisteredException e) { } catch (NotRegisteredException e) {
throw new UserErrorException("User " + username + " is not registered."); throw new UserErrorException("User " + username + " is not registered.");
} catch (Throwable e) { } catch (Throwable e) {
throw new UnexpectedErrorException("Error loading state file for user " + username + ": " + e.getMessage()); throw new UnexpectedErrorException("Error loading state file for user "
+ username
+ ": "
+ e.getMessage()
+ " ("
+ e.getClass().getSimpleName()
+ ")");
} }
try { try {