0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd:Ⓜ️:room::auth: Improve error hierarchy.

This commit is contained in:
Jason Volk 2019-08-20 22:15:21 -07:00
parent 7e8d8666ff
commit 5e87a2e941
2 changed files with 9 additions and 0 deletions

View file

@ -21,6 +21,7 @@ struct ircd::m::room::auth
using types = vector_view<const string_view>; using types = vector_view<const string_view>;
using events_view = vector_view<const event *>; using events_view = vector_view<const event *>;
using passfail = std::tuple<bool, std::exception_ptr>; using passfail = std::tuple<bool, std::exception_ptr>;
IRCD_M_EXCEPTION(m::error, error, http::INTERNAL_SERVER_ERROR)
IRCD_M_EXCEPTION(error, FAIL, http::UNAUTHORIZED) IRCD_M_EXCEPTION(error, FAIL, http::UNAUTHORIZED)
static bool is_power_event(const event &); static bool is_power_event(const event &);

View file

@ -161,6 +161,7 @@ ircd::m::room::auth::passfail
IRCD_MODULE_EXPORT IRCD_MODULE_EXPORT
ircd::m::room::auth::check(std::nothrow_t, ircd::m::room::auth::check(std::nothrow_t,
const event &event) const event &event)
try
{ {
using json::at; using json::at;
@ -244,6 +245,13 @@ ircd::m::room::auth::check(std::nothrow_t,
return ret; return ret;
} }
catch(const std::exception &)
{
return
{
false, std::current_exception()
};
}
ircd::m::room::auth::passfail ircd::m::room::auth::passfail
IRCD_MODULE_EXPORT IRCD_MODULE_EXPORT