This commit changes the way DNSdist handles a non-existent Lua function
name being referenced from the YAML configuration: instead of silently
ignoring the problem, it loudly complains before exiting.
static bool getLuaFunctionFromConfiguration(FuncType& destination, const ::rust::string& functionName, const ::rust::string& functionCode, const ::rust::string& functionFile, const std::string& context)
{
if (!functionName.empty()) {
- return getOptionalLuaFunction<FuncType>(destination, functionName);
+ auto found = getOptionalLuaFunction<FuncType>(destination, functionName);
+ if (found) {
+ return true;
+ }
+ throw std::runtime_error("Unable to locate the Lua function named '" + std::string(functionName) + "', referenced by a lua directive in " + context + " context");
}
if (!functionCode.empty()) {
auto function = dnsdist::lua::getFunctionFromLuaCode<FuncType>(std::string(functionCode), context);