feat: add error handling for empty directive arguments in createDirective method
This commit is contained in:
parent
f6837bf8d5
commit
206a271142
@ -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())
|
if (type.empty())
|
||||||
{
|
{
|
||||||
throw std::invalid_argument("Unsupported directive: " + name);
|
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);
|
return create(type, name, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user