diff --git a/include/components/config.hpp b/include/components/config.hpp index 9c15f13e..30375a49 100644 --- a/include/components/config.hpp +++ b/include/components/config.hpp @@ -84,7 +84,10 @@ class config { template T get(const string& section, const string& key) const { auto it = m_sections.find(section); - if (it == m_sections.end() || it->second.find(key) == it->second.end()) { + if (it == m_sections.end()) { + throw key_error("Missing section \"" + section + "\""); + } + if (it->second.find(key) == it->second.end()) { throw key_error("Missing parameter \"" + section + "." + key + "\""); } return dereference(section, key, it->second.at(key), convert(string{it->second.at(key)}));