util: Reduce error messages for config options
A missing file is a common error that doesn't need to fill up the
journal.
Change-Id: I3f576b37d7bbe5c90c22b8138b192f66dbdb984c
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/util.cpp b/src/util.cpp
index f6880c3..5df9afa 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -213,7 +213,11 @@
std::string_view section, std::string_view key,
auto&& fun)
{
- if (auto str = config.map.getLastValueString(section, key); str == nullptr)
+ if (!config.getFileExists())
+ {
+ }
+ else if (auto str = config.map.getLastValueString(section, key);
+ str == nullptr)
{
auto err = fmt::format("Unable to get the value of {}[{}] from {}",
section, key, config.getFilename().native());