Skip to content

Commit

Permalink
config: report errors from sourced files
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Mar 11, 2024
1 parent 2201442 commit 6633028
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/config/ConfigManager.cpp
Expand Up @@ -2243,6 +2243,8 @@ std::optional<std::string> CConfigManager::handleSource(const std::string& comma
return err;
}

std::string errorsFromParsing;

for (size_t i = 0; i < glob_buf->gl_pathc; i++) {
auto value = absolutePath(glob_buf->gl_pathv[i], configCurrentPath);

Expand All @@ -2268,12 +2270,17 @@ std::optional<std::string> CConfigManager::handleSource(const std::string& comma
auto configCurrentPathBackup = configCurrentPath;
configCurrentPath = value;

m_pConfig->parseFile(value.c_str());
const auto THISRESULT = m_pConfig->parseFile(value.c_str());

configCurrentPath = configCurrentPathBackup;

if (THISRESULT.error && errorsFromParsing.empty())
errorsFromParsing += THISRESULT.getError();
}

return {};
if (errorsFromParsing.empty())
return {};
return errorsFromParsing;
}

std::optional<std::string> CConfigManager::handleEnv(const std::string& command, const std::string& value) {
Expand Down

0 comments on commit 6633028

Please sign in to comment.