fix bug where the error of a missing config.yml file was not handled;

pull/1/head
Bryan Biedenkapp 5 years ago
parent fae8dcea40
commit 82928b4727

@ -114,9 +114,15 @@ Host::~Host()
/// <returns>Zero if successful, otherwise error occurred.</returns>
int Host::run()
{
bool ret = yaml::Parse(m_conf, m_confFile.c_str());
if (!ret) {
::fatal("cannot read the configuration file, %s\n", m_confFile.c_str());
bool ret = false;
try {
ret = yaml::Parse(m_conf, m_confFile.c_str());
if (!ret) {
::fatal("cannot read the configuration file, %s\n", m_confFile.c_str());
}
}
catch (yaml::OperationException e) {
::fatal("cannot read the configuration file, %s", e.message());
}
bool m_daemon = m_conf["daemon"].as<bool>(false);

Loading…
Cancel
Save

Powered by TurnKey Linux.