Improve handling of common error.
This commit is contained in:
parent
f4d3905f52
commit
53e95d02ab
1 changed files with 5 additions and 4 deletions
|
|
@ -203,11 +203,12 @@ public class Runner extends Component {
|
|||
// Configuration store with file in /etc (default)
|
||||
File config = new File(cmdLine.getOptionValue('c',
|
||||
"/etc/" + APP_NAME + "/config.yaml"));
|
||||
try {
|
||||
attach(new YamlConfigurationStore(channel(), config, false));
|
||||
} catch (IOException e) {
|
||||
System.err.println("Cannot open configuration file " + config);
|
||||
// Don't rely on night config to produce a good exception
|
||||
// for this simple case
|
||||
if (!Files.isReadable(config.toPath())) {
|
||||
throw new IOException("Cannot read configuration file " + config);
|
||||
}
|
||||
attach(new YamlConfigurationStore(channel(), config, false));
|
||||
fire(new WatchFile(config.toPath()));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue