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:
parent
5f4d8afd86
commit
10854b2886
1 changed files with 15 additions and 0 deletions
|
@ -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)...
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
|
Loading…
Reference in a new issue