0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 19:28:52 +02:00

ircd::http: Add format string error ctor template.

This commit is contained in:
Jason Volk 2019-09-28 14:12:53 -07:00
parent 5f4d8afd86
commit 10854b2886

View file

@ -52,6 +52,7 @@ struct ircd::http::error
error() = default;
error(const http::code &, std::string content = {}, std::string headers = {});
error(const http::code &, std::string content, const vector_view<const header> &);
template<class... args> error(const string_view &fmt, const http::code &, args&&...);
};
/// Represents a single \r\n delimited line used in HTTP.
@ -375,3 +376,17 @@ const
{
return lex_cast<T>(at(key, idx));
}
template<class... args>
ircd::http::error::error(const string_view &fmt,
const http::code &code,
args&&... a)
:error
{
code,
fmt::snstringf //TODO: XXX fmt::sstringf
{
3192, fmt, std::forward<args>(a)...
}
}
{}