feat: add error handling for empty configuration files
This commit is contained in:
parent
d8fb7d0846
commit
8609dee529
@ -50,6 +50,12 @@ void ConfigManager::parseConfigFile(const std::string &filePath)
|
|||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
buffer << file.rdbuf();
|
buffer << file.rdbuf();
|
||||||
std::string content = buffer.str();
|
std::string content = buffer.str();
|
||||||
|
|
||||||
|
if (content.empty())
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Config file is empty: " + filePath);
|
||||||
|
}
|
||||||
|
|
||||||
utils::removeComments(content);
|
utils::removeComments(content);
|
||||||
globalConfig_ = std::make_unique<GlobalConfig>(content);
|
globalConfig_ = std::make_unique<GlobalConfig>(content);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user