feat: add error handling for empty directive arguments in createDirective method

This commit is contained in:
whaffman 2025-10-31 10:05:03 +01:00
parent f6837bf8d5
commit 206a271142

View File

@ -33,12 +33,16 @@ std::unique_ptr<ADirective> DirectiveFactory::createDirective(const std::string
}
}
if (arg.empty())
{
throw std::invalid_argument("Directive argument is empty: " + name);
}
if (type.empty())
{
throw std::invalid_argument("Unsupported directive: " + name);
}
Log::debug("Creating directive of type: " + std::string(type) + " with name: " + name + " and arg: " + arg);
Log::debug("Creating directive of type: " + std::string(type) + " with name: " + name + " and arg: |" + arg + "|");
return create(type, name, arg);
}