diff --git a/src/config/Data.cxx b/src/config/Data.cxx index f4535c599..6ab5f20ba 100644 --- a/src/config/Data.cxx +++ b/src/config/Data.cxx @@ -21,7 +21,7 @@ #include "Data.hxx" #include "Param.hxx" #include "Block.hxx" -#include "system/FatalError.hxx" +#include "util/RuntimeError.hxx" #include "util/StringAPI.hxx" void @@ -40,14 +40,14 @@ ConfigData::Clear() const ConfigBlock * ConfigData::FindBlock(ConfigBlockOption option, - const char *key, const char *value) const noexcept + const char *key, const char *value) const { for (const auto *block = GetBlock(option); block != nullptr; block = block->next) { const char *value2 = block->GetBlockValue(key); if (value2 == nullptr) - FormatFatalError("block without '%s' in line %d", - key, block->line); + throw FormatRuntimeError("block without '%s' in line %d", + key, block->line); if (StringIsEqual(value2, value)) return block; diff --git a/src/config/Data.hxx b/src/config/Data.hxx index 940440d7d..45ce1c95a 100644 --- a/src/config/Data.hxx +++ b/src/config/Data.hxx @@ -43,9 +43,12 @@ struct ConfigData { return blocks[size_t(option)]; } + /** + * Throws if a block doesn't have the specified (mandatory) key. + */ gcc_pure const ConfigBlock *FindBlock(ConfigBlockOption option, - const char *key, const char *value) const noexcept; + const char *key, const char *value) const; }; #endif