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

ircd:Ⓜ️ Improve error ctor related.

This commit is contained in:
Jason Volk 2018-03-05 01:34:03 -08:00
parent 664bee7f78
commit bfc2ab4eef
2 changed files with 10 additions and 5 deletions

View file

@ -40,7 +40,8 @@ class ircd::m::error
error(const http::code &, const json::members &);
error(const http::code &, const json::iov &);
error(const http::code &);
error(std::string = {});
error(std::string);
error();
IRCD_OVERLOAD(child)
template<class... args> error(child_t, args&&... a)
@ -75,10 +76,10 @@ struct _name_ \
child, _httpcode_, "M_"#_name_, "%s", http::status(_httpcode_) \
}{} \
\
template<class... args> _name_(args&&... a) \
template<class... args> _name_(const char *const &fmt, args&&... a) \
: _parent_ \
{ \
child, _httpcode_, "M_"#_name_, std::forward<args>(a)... \
child, _httpcode_, "M_"#_name_, fmt, std::forward<args>(a)... \
}{} \
\
template<class... args> _name_(child_t, args&&... a) \
@ -134,6 +135,6 @@ ircd::m::error::error(const string_view &errcode,
args&&... a)
:error
{
http::BAD_REQUEST, errcode, fmt, std::forward<args>(a)...
http::INTERNAL_SERVER_ERROR, errcode, fmt, std::forward<args>(a)...
}
{}

View file

@ -964,12 +964,16 @@ thread_local char
ircd::m::error::fmtbuf[768]
{};
ircd::m::error::error()
:http::error{http::INTERNAL_SERVER_ERROR}
{}
ircd::m::error::error(std::string c)
:http::error{http::INTERNAL_SERVER_ERROR, std::move(c)}
{}
ircd::m::error::error(const http::code &c)
:http::error{c}
:http::error{c, std::string{}}
{}
ircd::m::error::error(const http::code &c,