Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log a warning when parsing of the config file has failed #66

Merged
merged 2 commits into from Feb 15, 2018

Conversation

talkrz
Copy link
Contributor

@talkrz talkrz commented Feb 13, 2018

The current behaviour is counterintuitive. The config is silently ignored without any message when there is JSON parse error.
So I added a warning, but one can still omit the config file to use the default configuration.

@@ -70,7 +70,9 @@ bool SSEConfig::load(const char *file) {
// Read config file.
try {
boost::property_tree::read_json(file, pt);
} catch (...) {}
} catch (boost::property_tree::ptree_error& e) {
LOG(WARNING) << "Error during loading config file: " << e.what();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps log FATAL instead of WARNING? It shouldn't be able to start up at all without a proper config.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing, this is absolutely a check we should have. I agree with @sgulseth regarding that it should be a FATAL and not a warning. Add in that and I will merge the PR!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've changed it to FATAL and now the app doesn't start when config is not parsed or not present. Thanks for your feedback.

@olesku olesku merged commit 0eb3e34 into vgno:master Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants