feat: enhance error messages in SizeDirective for invalid size directives

This commit is contained in:
whaffman 2025-10-31 10:05:17 +01:00
parent 206a271142
commit 0ac362face

View File

@ -24,7 +24,7 @@ void SizeDirective::parse(const std::string &value)
number = utils::trim(number);
if (number.find_first_not_of("01234567890kmg") != std::string::npos)
{
throw std::invalid_argument("Invalid size directive: " + value);
throw std::invalid_argument("Invalid size directive: " + value + " in " + name_);
}
try
{
@ -32,7 +32,7 @@ void SizeDirective::parse(const std::string &value)
}
catch (const std::exception &e)
{
throw std::invalid_argument("Invalid size directive: " + value + " - " + e.what());
throw std::invalid_argument("Invalid size directive: " + value + " in " + name_ + " - " + e.what());
}
if (idx == number.size())
{
@ -53,7 +53,7 @@ void SizeDirective::parse(const std::string &value)
}
else
{
throw std::invalid_argument("Invalid size directive: " + value);
throw std::invalid_argument("Invalid size directive: " + value + " in " + name_);
}
value_ *= multiplier;