0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 23:10:54 +01:00

ircd::http: Improve query::string::at() error message to show key name.

This commit is contained in:
Jason Volk 2018-08-30 10:58:32 -07:00
parent ac3b45604a
commit 83edde639f

View file

@ -523,7 +523,18 @@ const
{
const auto ret(operator[](key));
if(ret.empty())
throw std::out_of_range{"Failed to find value for required query string key"};
{
thread_local char buf[1024];
const string_view msg{fmt::sprintf
{
buf, "Failed to find value for required query string key '%s'", key
}};
throw std::out_of_range
{
msg.c_str() // fmt::sprintf() will null terminate msg
};
}
return ret;
}