0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

ircd:Ⓜ️🆔 Improve the validator error msg propagation; minor cleanup.

This commit is contained in:
Jason Volk 2018-03-13 15:40:22 -07:00
parent 0f5e84b2e0
commit 7deebfd344

View file

@ -277,7 +277,6 @@ const try
const rule<string_view> view_mxid
{
raw[&lit(char(sigil)) > mxid]
,"mxid"
};
string_view out;
@ -340,7 +339,6 @@ const try
const rule<string_view> valid_mxid
{
&lit(char(sigil)) > mxid
,"mxid"
};
const char *start{id.data()};
@ -585,26 +583,16 @@ ircd::m::my(const id &id)
void
ircd::m::validate(const id::sigil &sigil,
const string_view &id)
try
{
id::validator(sigil, id);
}
catch(const std::exception &e)
{
throw INVALID_MXID
{
"Not a valid '%s' mxid: %s",
reflect(sigil),
e.what()
};
}
bool
ircd::m::valid(const id::sigil &sigil,
const string_view &id)
noexcept try
{
id::validator(sigil, id);
validate(sigil, id);
return true;
}
catch(...)
@ -715,7 +703,7 @@ void
ircd::m::failure(const qi::expectation_failure<const char *> &e,
const string_view &goal)
{
auto rule
const auto rule
{
ircd::string(e.what_)
};