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);
|
writeConfig(configClass, object);
|
||||||
REGISTERED_CONFIGURATIONS.add(object);
|
REGISTERED_CONFIGURATIONS.add(object);
|
||||||
return object;
|
return object;
|
||||||
} catch (IOException ioException) {
|
} catch (Exception e) {
|
||||||
LOGGER.error(ioException);
|
LOGGER.error(e);
|
||||||
LOGGER.info(String.format("Read error, using default values for config %s.", configClass.toString()));
|
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 draylar.omegaconfig.api.Config;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ClassConfigTest implements Config {
|
public class ClassConfigTest implements Config {
|
||||||
|
|
||||||
public TestClass[] testClass = {
|
public List<TestClass> l = Arrays.asList(
|
||||||
new TestClass()
|
new TestClass()
|
||||||
};
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
Reference in New Issue
Block a user