From 82928b472700fd69fa1bf7f7c81f46a31f2533fa Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Tue, 9 Feb 2021 22:11:55 +0000 Subject: [PATCH] fix bug where the error of a missing config.yml file was not handled; --- host/Host.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/host/Host.cpp b/host/Host.cpp index 2b2216e9..d37b1aa0 100644 --- a/host/Host.cpp +++ b/host/Host.cpp @@ -114,9 +114,15 @@ Host::~Host() /// Zero if successful, otherwise error occurred. 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(false);