adjust error handling to catch all errors when reading config
This commit is contained in:
@@ -85,9 +85,10 @@ public class OmegaConfig {
|
||||
writeConfig(configClass, object);
|
||||
REGISTERED_CONFIGURATIONS.add(object);
|
||||
return object;
|
||||
} catch (IOException ioException) {
|
||||
LOGGER.error(ioException);
|
||||
LOGGER.info(String.format("Read error, using default values for config %s.", configClass.toString()));
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e);
|
||||
LOGGER.info(String.format("Encountered an error while reading %s config, falling back to default values.", config.getName()));
|
||||
LOGGER.info(String.format("If this problem persists, delete the config file %s and try again.", config.getName() + "." + config.getExtension()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,14 @@ package draylar.omegatest.config;
|
||||
|
||||
import draylar.omegaconfig.api.Config;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ClassConfigTest implements Config {
|
||||
|
||||
public TestClass[] testClass = {
|
||||
public List<TestClass> l = Arrays.asList(
|
||||
new TestClass()
|
||||
};
|
||||
);
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
||||
Reference in New Issue
Block a user