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:
parent
ac3b45604a
commit
83edde639f
1 changed files with 12 additions and 1 deletions
13
ircd/http.cc
13
ircd/http.cc
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue