Log filenames during configuration serialization errors (#4959)

This commit is contained in:
Josh Roy 2022-06-21 18:01:25 -04:00 committed by GitHub
parent 8d856dd6db
commit ff80338350
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,14 +85,14 @@ public abstract class UserData extends PlayerExtension implements IConf {
try { try {
holder = config.getRootNode().get(UserConfigHolder.class); holder = config.getRootNode().get(UserConfigHolder.class);
} catch (SerializationException e) { } catch (SerializationException e) {
ess.getLogger().log(Level.SEVERE, "Error while reading user config: " + e.getMessage(), e); ess.getLogger().log(Level.SEVERE, "Error while reading user config: " + config.getFile().getName(), e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
config.setSaveHook(() -> { config.setSaveHook(() -> {
try { try {
config.getRootNode().set(UserConfigHolder.class, holder); config.getRootNode().set(UserConfigHolder.class, holder);
} catch (SerializationException e) { } catch (SerializationException e) {
ess.getLogger().log(Level.SEVERE, "Error while saving user config: " + e.getMessage(), e); ess.getLogger().log(Level.SEVERE, "Error while saving user config: " + config.getFile().getName(), e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}); });