From 0ac362facebae24dc86944f6b7e68157754b2586 Mon Sep 17 00:00:00 2001 From: whaffman Date: Fri, 31 Oct 2025 10:05:17 +0100 Subject: [PATCH] feat: enhance error messages in SizeDirective for invalid size directives --- webserv/config/directive/SizeDirective.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webserv/config/directive/SizeDirective.cpp b/webserv/config/directive/SizeDirective.cpp index 0e470b1..ed85c02 100644 --- a/webserv/config/directive/SizeDirective.cpp +++ b/webserv/config/directive/SizeDirective.cpp @@ -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;