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:
parent
0f5e84b2e0
commit
7deebfd344
1 changed files with 2 additions and 14 deletions
16
ircd/m/id.cc
16
ircd/m/id.cc
|
@ -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_)
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue